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

HAVING COUNT(*) NOT IN ( <Q> ) prevent record from appearing in outer resultset when it should be there (<Q> = resultset without nulls) [CORE5165] #5448

Closed
firebird-issue-importer opened this issue Mar 23, 2016 · 4 comments

Comments

@firebird-issue-importer

Submitted by: @pavel-zotov

(created as separate ticket after Adriano suggestion; text below was moved here from CORE5153)

Consider following sample:

set list on;
set count on;
select 1 as check_ok
from rdb$database r
group by r.rdb$relation_id
having count(*) not in (select -1 from rdb$database r2)
;

NOT-IN subquery has not NULLs so HAVING clause should NOT prevent from returning one row.

But results differ on 2.5 vs (3.0 RC2 and 4.0 Unstable):

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\fb25\bin\isql /:e25 -z -i c5153x.sql
ISQL Version: WI-V2.5.6.26980 Firebird 2.5
Server version:
WI-V2.5.6.26980 Firebird 2.5
WI-V2.5.6.26980 Firebird 2.5/tcp (csprog)/P12
WI-V2.5.6.26980 Firebird 2.5/tcp (csprog)/P12

CHECK_OK 1

Records affected: 1

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\fb30\isql /:e30 -z -i c5153x.sql
ISQL Version: WI-V3.0.0.32383 Firebird 3.0 Release Candidate 2
Server version:
WI-V3.0.0.32383 Firebird 3.0 Release Candidate 2
WI-V3.0.0.32383 Firebird 3.0 Release Candidate 2/tcp (csprog)/P13
WI-V3.0.0.32383 Firebird 3.0 Release Candidate 2/tcp (csprog)/P13
Records affected: 0

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\fb40\isql /:e40 -z -i c5153x.sql
ISQL Version: WI-T4.0.0.32400 Firebird 4.0 Unstable
Server version:
WI-T4.0.0.32400 Firebird 4.0 Unstable
WI-T4.0.0.32400 Firebird 4.0 Unstable/tcp (csprog)/P13
WI-T4.0.0.32400 Firebird 4.0 Unstable/tcp (csprog)/P13
Records affected: 0

PS. Versions: WI-V3.0.0.32383 and WI-T4.0.0.32400 - were downloaded from snapshot directory just now:

C:\1TMP>dir /-c Firebird-3.0.0.32383-0_Win32.7z Firebird-4.0.0.32400-0_Win32.7z |findstr /i fir
23.03.2016 16:48 6562751 Firebird-3.0.0.32383-0_Win32.7z
23.03.2016 16:46 5401474 Firebird-4.0.0.32400-0_Win32.7z

Unfortunately, we have no more (or not yet ?) subsequent number of builds after moving on git, so they are the same as before.

Commits: 83e9537 f72de29

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 24, 2016

Commented by: @asfernandes

2.5 is affected by similar problem and bugchecks if COUNT(*) is repalced by COUNT(1)

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 27, 2016

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.0 [ 10740 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 31, 2016

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 31, 2016

Modified by: @pavel-zotov

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

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