citus icon indicating copy to clipboard operation
citus copied to clipboard

Pg18 - different scan type on pg_class

Open m3hm3t opened this issue 1 month ago • 2 comments

related to https://github.com/citusdata/citus/issues/8279

diff -dU10 -w /__w/citus/citus/src/test/regress/expected/multi_mx_hide_shard_names.out /__w/citus/citus/src/test/regress/results/multi_mx_hide_shard_names.out
--- /__w/citus/citus/src/test/regress/expected/multi_mx_hide_shard_names.out.modified	2025-10-17 11:46:12.512182101 +0000
+++ /__w/citus/citus/src/test/regress/results/multi_mx_hide_shard_names.out.modified	2025-10-17 11:46:12.526182131 +0000
@@ -116,25 +116,24 @@
      LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
 WHERE c.relname OPERATOR(pg_catalog.~) '^(test_table)$' COLLATE pg_catalog.default
   AND pg_catalog.pg_table_is_visible(c.oid)
 ORDER BY 2, 3;
                                                                 QUERY PLAN                                                                
 ------------------------------------------------------------------------------------------------------------------------------------------
  Sort
    Sort Key: n.nspname, c.relname
    ->  Nested Loop Left Join
          Join Filter: (n.oid = c.relnamespace)
-         ->  Index Scan using pg_class_relname_nsp_index on pg_class c
-               Index Cond: (relname = 'test_table'::text)
+         ->  Seq Scan on pg_class c

multi_mx_hide_shard_names is intended to mimc the \d implementation.

m3hm3t avatar Nov 21 '25 08:11 m3hm3t

"So it looks like PG18 has broken the PR (#7577) that created this test, going by the comment there: Check that query that psql "\d test_table" does gets optimized to an index

This is not happening with PG18 and we should understand why. Removing COLLATE pg_catalog.defaultdoes enable an index scan, but reading between the lines that is put there behind the scens by \dso we can't drop it, at least without knowing how \dis implemented in PG18."

m3hm3t avatar Nov 21 '25 08:11 m3hm3t

describeTableDetails -> validateSQLNamePattern -> processSQLNamePattern

postgres/src/fe_utils/string_utils.c at REL_16_STABLE · postgres/postgres

m3hm3t avatar Nov 21 '25 08:11 m3hm3t