PG18 - Adjust columnar path tests for PG18 OR clause optimization (#8337)

fixes #8264

PostgreSQL 18 introduced a planner improvement (commit `ae4569161`) that
rewrites simple `OR` equality clauses into `= ANY(...)` forms, allowing
the use of a single index scan instead of multiple scans or a custom
scan.
This change affects the columnar path tests where queries like `a=0 OR
a=5` previously chose a Columnar or Seq Scan plan.

In this PR:

* Updated test expectations for `uses_custom_scan` and `uses_seq_scan`
to reflect the new index scan plan.

This keeps the test output consistent with PostgreSQL 18’s updated
planner behavior.
pull/8332/head^2
Mehmet YILMAZ 2025-11-13 09:32:21 +03:00 committed by GitHub
parent 4244bc8516
commit f80fa1c83b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 34 additions and 15 deletions

View File

@ -204,18 +204,24 @@ $$
t t
(1 row) (1 row)
SELECT columnar_test_helpers.uses_custom_scan ( BEGIN;
$$ SET LOCAL enable_indexscan TO 'OFF';
SELECT a FROM full_correlated WHERE a=0 OR a=5; SET LOCAL enable_bitmapscan TO 'OFF';
$$ SELECT columnar_test_helpers.uses_custom_scan (
); $$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
$$
);
uses_custom_scan uses_custom_scan
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
ROLLBACK;
BEGIN; BEGIN;
SET LOCAL columnar.enable_custom_scan TO 'OFF'; SET LOCAL columnar.enable_custom_scan TO 'OFF';
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_seq_scan ( SELECT columnar_test_helpers.uses_seq_scan (
$$ $$
SELECT a FROM full_correlated WHERE a=0 OR a=5; SELECT a FROM full_correlated WHERE a=0 OR a=5;

View File

@ -204,18 +204,24 @@ $$
t t
(1 row) (1 row)
SELECT columnar_test_helpers.uses_custom_scan ( BEGIN;
$$ SET LOCAL enable_indexscan TO 'OFF';
SELECT a FROM full_correlated WHERE a=0 OR a=5; SET LOCAL enable_bitmapscan TO 'OFF';
$$ SELECT columnar_test_helpers.uses_custom_scan (
); $$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
$$
);
uses_custom_scan uses_custom_scan
--------------------------------------------------------------------- ---------------------------------------------------------------------
t t
(1 row) (1 row)
ROLLBACK;
BEGIN; BEGIN;
SET LOCAL columnar.enable_custom_scan TO 'OFF'; SET LOCAL columnar.enable_custom_scan TO 'OFF';
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_seq_scan ( SELECT columnar_test_helpers.uses_seq_scan (
$$ $$
SELECT a FROM full_correlated WHERE a=0 OR a=5; SELECT a FROM full_correlated WHERE a=0 OR a=5;

View File

@ -141,14 +141,21 @@ SELECT a FROM full_correlated WHERE a>200;
$$ $$
); );
SELECT columnar_test_helpers.uses_custom_scan (
$$ BEGIN;
SELECT a FROM full_correlated WHERE a=0 OR a=5; SET LOCAL enable_indexscan TO 'OFF';
$$ SET LOCAL enable_bitmapscan TO 'OFF';
); SELECT columnar_test_helpers.uses_custom_scan (
$$
SELECT a FROM full_correlated WHERE a=0 OR a=5;
$$
);
ROLLBACK;
BEGIN; BEGIN;
SET LOCAL columnar.enable_custom_scan TO 'OFF'; SET LOCAL columnar.enable_custom_scan TO 'OFF';
SET LOCAL enable_indexscan TO 'OFF';
SET LOCAL enable_bitmapscan TO 'OFF';
SELECT columnar_test_helpers.uses_seq_scan ( SELECT columnar_test_helpers.uses_seq_scan (
$$ $$
SELECT a FROM full_correlated WHERE a=0 OR a=5; SELECT a FROM full_correlated WHERE a=0 OR a=5;