Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong order when using collation DE_DE [CORE4026] #4356

Closed
firebird-automations opened this issue Jan 3, 2013 · 7 comments
Closed

wrong order when using collation DE_DE [CORE4026] #4356

firebird-automations opened this issue Jan 3, 2013 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Volker Rehn (vr2_s18)

Votes: 1

Only digits and alphabet characters are used for sorting, everything else (#⁠$%&_[]{}/"!<>~+*:;,. etc) is ignored. Collation DE_DE is not a CI_AI etc collation, it should work with other characters too. Test case:

CREATE TABLE TBL (
ENTRY VARCHAR(30) COLLATE DE_DE
);

INSERT INTO TBL (ENTRY) VALUES('0');
INSERT INTO TBL (ENTRY) VALUES('''+''0 %;''-''0 %');
INSERT INTO TBL (ENTRY) VALUES('0.00');
INSERT INTO TBL (ENTRY) VALUES('0.00 %');
INSERT INTO TBL (ENTRY) VALUES('''+''0.000;''-''0.000');
INSERT INTO TBL (ENTRY) VALUES('abc');
INSERT INTO TBL (ENTRY) VALUES('def');
INSERT INTO TBL (ENTRY) VALUES('NNN');
INSERT INTO TBL (ENTRY) VALUES('yyy');

select entry from tbl
order by 1

gives:

ENTRY

0
'+'0 %;'-'0 %
0.00
0.00 %
'+'0.000;'-'0.000
abc
def
NNN
yyy

Regards Volker

@firebird-automations
Copy link
Collaborator Author

Modified by: Volker Rehn (vr2_s18)

environment: Win7, XP, Firebird 2.5.2 => Win7, XP

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

The collation does actually sort the other characters, but it seems to apply a different sort (if you insert the same values in different order multiple times they are actually grouped together when sorted).

de_de isn't the only collation with this behavior. It also occurs for (only checked for ISO8859_1 collations):
da_da, du_nl, fi_fi, fr_fr, fr_ca, de_de, is_is, it_it, no_no, sv_sv, en_uk, pt_pt

The following sort as expected (based on this small sample):
es_es, en_us, pt_br, es_es_ci_ai, fr_fr_ci_ai

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Volker, this is as designed, and you can change this customizing the collation with:

create collation de_de2 for iso8859_1 from de_de 'SPECIALS-FIRST=1';

And then use de_de2 or whatever the name you use. The order will be:

'+'0 %;'-'0 %
'+'0.000;'-'0.000
0
0.00
0.00 %
abc
def
NNN
yyy

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

I am curious to the logic that doesn't sort 0 next to 0.00

@firebird-automations
Copy link
Collaborator Author

Commented by: Volker Rehn (vr2_s18)

Thanks a lot, Adriano and Mark. That helps. Now -

1. What's the point of ignoring parts of the charset when sorting? This is rather counter-intuitive.
2. Why is this behavoiur inconsistent even across standard collations?
3. Why not make complete sorting the default and instead have an attribute 'IGNORE-SPECIALS'?
4. and finally, I'm curious too how to sort 0 away from 0.00 ;-)

Regards Volker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant