Skip to content

Commit d586756

Browse files
committed
NOT operator fixed
1 parent 0457402 commit d586756

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

expected/pathman_basic.out

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,41 @@ EXPLAIN (COSTS OFF) SELECT * FROM messages;
14281428
-> Seq Scan on messages_2
14291429
(3 rows)
14301430

1431+
/* Testing NOT operator */
1432+
CREATE TABLE bool_test(a serial, b BOOLEAN);
1433+
SELECT create_hash_partitions('bool_test', 'a', 3);
1434+
create_hash_partitions
1435+
------------------------
1436+
3
1437+
(1 row)
1438+
1439+
INSERT INTO bool_test SELECT g, (g % 2) = 0 FROM GENERATE_SERIES(1, 100) AS g;
1440+
SELECT count(*) FROM bool_test;
1441+
count
1442+
-------
1443+
100
1444+
(1 row)
1445+
1446+
SELECT count(*) FROM bool_test WHERE (b = true AND b = false);
1447+
count
1448+
-------
1449+
0
1450+
(1 row)
1451+
1452+
SELECT count(*) FROM bool_test WHERE b = false;
1453+
count
1454+
-------
1455+
50
1456+
(1 row)
1457+
1458+
SELECT count(*) FROM bool_test WHERE b = false;
1459+
count
1460+
-------
1461+
50
1462+
(1 row)
1463+
1464+
DROP TABLE bool_test CASCADE;
1465+
NOTICE: drop cascades to 3 other objects
14311466
DROP SCHEMA test CASCADE;
14321467
NOTICE: drop cascades to 13 other objects
14331468
DROP EXTENSION pg_pathman CASCADE;

sql/pathman_basic.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,15 @@ ALTER TABLE replies DROP CONSTRAINT replies_message_id_fkey;
387387
SELECT create_range_partitions('messages', 'id', 1, 100, 2);
388388
EXPLAIN (COSTS OFF) SELECT * FROM messages;
389389

390+
/* Testing NOT operator */
391+
CREATE TABLE bool_test(a serial, b BOOLEAN);
392+
SELECT create_hash_partitions('bool_test', 'a', 3);
393+
INSERT INTO bool_test SELECT g, (g % 2) = 0 FROM GENERATE_SERIES(1, 100) AS g;
394+
SELECT count(*) FROM bool_test;
395+
SELECT count(*) FROM bool_test WHERE (b = true AND b = false);
396+
SELECT count(*) FROM bool_test WHERE b = false;
397+
SELECT count(*) FROM bool_test WHERE b = false;
398+
DROP TABLE bool_test CASCADE;
390399

391400
DROP SCHEMA test CASCADE;
392401
DROP EXTENSION pg_pathman CASCADE;

src/pg_pathman.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ handle_boolexpr(const BoolExpr *expr, WalkerContext *context)
15331533
default:
15341534
result->rangeset = list_make1_irange(make_irange(0,
15351535
PrelLastChild(prel),
1536-
false));
1536+
true));
15371537
break;
15381538
}
15391539
}

0 commit comments

Comments
 (0)