Apache Cloudberry version
main branch (recent build)
What happened
With ORCA enabled, a query filtering on a column that is only an INCLUDE column of an index fails at execution time with an internal error:
ERROR: bogus index qualification (nodeIndexscan.c:1249)
ORCA generates an index scan on bogus_i and pushes c1 into the index qualification (EXPLAIN shows Index Cond: (c1 = true)), but c1 is a non-key INCLUDE column and ExecIndexBuildScanKeys rejects it. Line number is from current main. With optimizer = off the query returns the correct 2 rows.
Found by SQLancer.
What you think should happen instead
The query should return the two rows where c1 is true, with either optimizer.
How to reproduce
CREATE TABLE bogus_t (c0 boolean, c1 boolean);
CREATE INDEX bogus_i ON bogus_t (c0) INCLUDE (c1);
INSERT INTO bogus_t VALUES (true, true), (false, true), (true, false);
SET optimizer = on;
SELECT * FROM bogus_t WHERE c1;
-- ERROR: bogus index qualification (nodeIndexscan.c:1249)
SET optimizer = off;
SELECT * FROM bogus_t WHERE c1;
-- 2 rows
Operating System
Linux
Anything else
Found while running SQLancer against Cloudberry main (3-segment demo cluster, --enable-cassert). See the proposal to run SQLancer continuously: #1952
Are you willing to submit PR?
Code of Conduct
Apache Cloudberry version
main branch (recent build)
What happened
With ORCA enabled, a query filtering on a column that is only an
INCLUDEcolumn of an index fails at execution time with an internal error:ORCA generates an index scan on
bogus_iand pushesc1into the index qualification (EXPLAINshowsIndex Cond: (c1 = true)), butc1is a non-keyINCLUDEcolumn andExecIndexBuildScanKeysrejects it. Line number is from currentmain. Withoptimizer = offthe query returns the correct 2 rows.Found by SQLancer.
What you think should happen instead
The query should return the two rows where
c1is true, with either optimizer.How to reproduce
Operating System
Linux
Anything else
Found while running SQLancer against Cloudberry
main(3-segment demo cluster,--enable-cassert). See the proposal to run SQLancer continuously: #1952Are you willing to submit PR?
Code of Conduct