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

SELECT from derived table which contains GROUP BY on field with literal value returns wrong result [CORE4360] #4682

Closed
firebird-issue-importer opened this issue Mar 9, 2014 · 8 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Mar 9, 2014

Submitted by: @pavel-zotov

Is related to QA594

LI-T3.0.0.30889

Sample 1.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select 'a' c from rdb$database group by 'a' );

C

SQL>

(record with letter 'a' does not appear)

Sample 2.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select 123 c from rdb$database group by 1 );

       C

============
0

(why ZERO ??)

Sample 3.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select current_timestamp c from rdb$database group by 1 );

                    C

=========================
1858-11-17 00:00:00.0000

(this date is known as Modified Julian Day, but it is NOT 'begin of epoch' in FB; so, why it is here ?)

PS. Results in LI-V2.5.3.26744 looks OK:

SQL> select c from( select 'a' c from rdb$database group by 'a' );

C

a

SQL> select c from( select 123 c from rdb$database group by 1 );

       C

============
123

SQL> select c from( select current_timestamp c from rdb$database group by 1 );

                    C

=========================
2014-03-09 09:46:42.0180

Commits: 523f1ea FirebirdSQL/fbt-repository@5dbcbd3

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 9, 2014

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 9, 2014

Modified by: @dyemanov

description: LI-T3.0.0.30889

Sample 1.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select 'a' c from rdb$database group by 'a' ) x group by c;

C

SQL>

(record with letter 'a' does not appear)

Sample 2.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select 123 c from rdb$database group by 1 ) x group by c;

       C

============
0

(why ZERO ??)

Sample 3.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select current_timestamp c from rdb$database group by 1 ) x group by c;

                    C

=========================
1858-11-17 00:00:00.0000

(this date is known as Modified Julian Day, but it is NOT 'begin of epoch' in FB; so, why it is here ?)

PS. Results in LI-V2.5.3.26744 looks OK:

SQL> select c from( select 'a' c from rdb$database group by 'a' ) x group by c;

C

a

SQL> select c from( select 123 c from rdb$database group by 1 ) x group by c;

       C

============
123

SQL> select c from( select current_timestamp c from rdb$database group by 1 ) x group by c;

                    C

=========================
2014-03-09 09:46:42.0180

=>

LI-T3.0.0.30889

Sample 1.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select 'a' c from rdb$database group by 'a' );

C

SQL>

(record with letter 'a' does not appear)

Sample 2.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select 123 c from rdb$database group by 1 );

       C

============
0

(why ZERO ??)

Sample 3.
#⁠#⁠#⁠#⁠#⁠#⁠#⁠#⁠
SQL> select c from( select current_timestamp c from rdb$database group by 1 );

                    C

=========================
1858-11-17 00:00:00.0000

(this date is known as Modified Julian Day, but it is NOT 'begin of epoch' in FB; so, why it is here ?)

PS. Results in LI-V2.5.3.26744 looks OK:

SQL> select c from( select 'a' c from rdb$database group by 'a' );

C

a

SQL> select c from( select 123 c from rdb$database group by 1 );

       C

============
123

SQL> select c from( select current_timestamp c from rdb$database group by 1 );

                    C

=========================
2014-03-09 09:46:42.0180

summary: group by from derived table which contains group by on field with LITERAL value returns wrong result => Select from derived table which contains GROUP BY on field with literal value returns wrong result

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 9, 2014

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 1 [ 10332 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 10, 2014

Modified by: Sean Leyne (seanleyne)

summary: Select from derived table which contains GROUP BY on field with literal value returns wrong result => SELECT from derived table which contains GROUP BY on field with literal value returns wrong result

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 29, 2014

Modified by: @pcisar

Link: This issue is related to QA594 [ QA594 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 30, 2015

Modified by: @pavel-zotov

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

QA Status: Done successfully

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 23, 2015

Commented by: @pcisar

Test created.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 23, 2015

Modified by: @pcisar

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

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