Skip to content

Commit 7ab7f0b

Browse files
bovlbmfenniak
andauthored
Fix IS NOT FALSE comparison using true value rather than false
Co-authored-by: Mathieu Fenniak <[email protected]>
1 parent 9697403 commit 7ab7f0b

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ void extractClauseFromBooleanTest(Relids base_relids, BooleanTest *node, List **
514514
break;
515515
case IS_NOT_FALSE:
516516
opname = "IS NOT";
517-
val = (Expr *) makeConst(BOOLOID, -1, InvalidOid, sizeof(bool), BoolGetDatum(true), false, true);
517+
val = (Expr *) makeConst(BOOLOID, -1, InvalidOid, sizeof(bool), BoolGetDatum(false), false, true);
518518
break;
519519
case IS_UNKNOWN:
520520
opname = "IS";

test-3.9/expected/multicorn_regression_test.out

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,20 @@ NOTICE: ['test1', 'test2', 'test3']
519519
-------+-------+-------
520520
(0 rows)
521521

522+
select * from testmulticorn where test1 IS NOT TRUE;
523+
NOTICE: [test1 IS NOT t]
524+
NOTICE: ['test1', 'test2', 'test3']
525+
test1 | test2 | test3
526+
-------+-------+-------
527+
(0 rows)
528+
529+
select * from testmulticorn where test1 IS NOT FALSE;
530+
NOTICE: [test1 IS NOT f]
531+
NOTICE: ['test1', 'test2', 'test3']
532+
test1 | test2 | test3
533+
-------+-------+-------
534+
(0 rows)
535+
522536
select * from testmulticorn where test1 IS UNKNOWN;
523537
NOTICE: [test1 IS None]
524538
NOTICE: ['test1', 'test2', 'test3']

test-3.9/sql/multicorn_regression_test.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ select * from testmulticorn where test1 = TRUE;
115115
select * from testmulticorn where test1 = FALSE;
116116
select * from testmulticorn where test1 IS TRUE;
117117
select * from testmulticorn where test1 IS FALSE;
118+
select * from testmulticorn where test1 IS NOT TRUE;
119+
select * from testmulticorn where test1 IS NOT FALSE;
118120
select * from testmulticorn where test1 IS UNKNOWN;
119121
select * from testmulticorn where test1 IS NOT UNKNOWN;
120122

0 commit comments

Comments
 (0)