Navigation Menu

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

CI column does not group correctly with a second column [CORE2555] #2965

Closed
firebird-automations opened this issue Jul 14, 2009 · 6 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Richard Wesley (hawkfish)

Relate to CORE1254

Attachments:
B24468.TDE

It appears that case instensitive collation can confuse the grouping logic when other columns are in play. The database is attached and the following output shows the issue.

First, the table. Note that the collation is case insensitive, so all grouping should be case insensitive.

SQL> show table "TableauExtract";
Group VARCHAR(1) CHARACTER SET UTF8 Nullable
COLLATE UNICODE_CI
ID DOUBLE PRECISION Nullable
Question DOUBLE PRECISION Nullable
Score DOUBLE PRECISION Nullable

Now, the broken query:

SQL> select "Group", "Question", SUM("Score") from "TableauExtract" group by 1,2;

Group Question SUM
====== ======================= =======================
a 1.000000000000000 174.0000000000000
a 2.000000000000000 122.0000000000000
a 3.000000000000000 220.0000000000000
A 1.000000000000000 141.0000000000000
A 2.000000000000000 110.0000000000000
A 3.000000000000000 164.0000000000000
t 1.000000000000000 157.0000000000000
t 2.000000000000000 173.0000000000000
t 3.000000000000000 175.0000000000000
T 1.000000000000000 122.0000000000000
T 2.000000000000000 154.0000000000000
T 3.000000000000000 57.00000000000000

There are twice as many rows as there should be. But, if there is only one grouping column, the problem goes away:

SQL> select "Group", SUM("Score") from "TableauExtract" group by 1;

Group SUM
====== =======================
A 931.0000000000000
T 838.0000000000000

Note also that the problem is NOT the grouping on a floating point number:

SQL> select "Question", SUM("Score") from "TableauExtract" group by 1;

           Question                     SUM

======================= =======================
1.000000000000000 594.0000000000000
2.000000000000000 559.0000000000000
3.000000000000000 616.0000000000000

This is happening in 2.1.1. It appears to be fixed in 2.5. Not sure about 2.1.2.

====== Test Details ======

As of current state (WI-T3.0.0.31832 beta-2), FB cah do GROUP BY
WITH using of index on multi-byte or insensitive collation only
when this index is: 1) UNIQUE and 2) ASCENDING.
Index still not used in DISTINCT statement, so it's not checked.
See comments in CORE4787.

@firebird-automations
Copy link
Collaborator Author

Modified by: Richard Wesley (hawkfish)

Attachment: B24468.TDE [ 11473 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

This is same problem of CORE1254 Problem with DISTINCT and insensitive collations.

I'm marking it as fixed instead of duplicate as the original bug does not talk about GROUP BY.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.5 Alpha 1 [ 10224 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue relate to CORE1254 [ CORE1254 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: Done successfully

Test Details: As of current state (WI-T3.0.0.31832 beta-2), FB cah do GROUP BY
WITH using of index on multi-byte or insensitive collation only
when this index is: 1) UNIQUE and 2) ASCENDING.
Index still not used in DISTINCT statement, so it's not checked.
See comments in CORE4787.

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

2 participants