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

GROUP BY RAND() returns infinite rows [CORE1943] #2382

Closed
firebird-automations opened this issue Jun 19, 2008 · 10 comments
Closed

GROUP BY RAND() returns infinite rows [CORE1943] #2382

firebird-automations opened this issue Jun 19, 2008 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: fabianobonin (fabianobonin)

Is related to QA349

The query below returns infinite rows:

select
1
from
rdb$database a
group by
rand()

Commits: f9e3032

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Fabiano,

This seems to be a "non-sense case" -- it does not reflected anything close to a real-world scenario -- as such, I think this should be considered a "won't fix" case.

Can you explain why GROUP BY RAND() would ever be used?

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Database engines should deal with "non-sense cases" too. Job of GROUP BY is not produce rows.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

I agree with Adriano. We already had such a problem previously with GROUP BY <constant>. The current one should also be solved. Our GROUP BY processing is somewhat non-optimal (to say at least).

@firebird-automations
Copy link
Collaborator Author

Commented by: fabianobonin (fabianobonin)

In my case, i was grouping by a "case", 'cause i need to group some rows from a procedure and keep others not grouped, but as the procedure didn't have a unique column, i used rand() to fake one. I fixed it changing the procedure to return a unique column and using it instead.

group by
case when ... then ... else rand() end

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.5 Beta 1 [ 10251 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA349 [ QA349 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

QA test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test => Done successfully

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