agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: pg_plan_advice: Disallow partition name without partition schema 2+ messages / 1 participants [nested] [flat]
* pgsql: pg_plan_advice: Disallow partition name without partition schema @ 2026-09-17 01:16 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2026-09-17 01:16 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_plan_advice: Disallow partition name without partition schema. Up until now, pg_plan_advice has had a feature that allows an advice target to mention a partition name but omit the partition schema; that is, something like SEQ_SCAN(foo/bar) forces a sequential scan on every child of table foo whose partition name is bar, regardless of the schema in which bar appears. However, that feature turns out to have a nasty design flaw: while advice enforcement handles this case just fine, the advice feedback code doesn't know about it and will mark such advice as "matched, failed" even when everything worked perfectly. Unfortunately, there seems to be no simple code fix for this problem. Since the release of PostgreSQL 19 is imminent, take the conservative course and revert this feature of pg_plan_advice. In other words, require the partition schema whenever the partition name is present. You must now write e.g. SEQ_SCAN(foo/public.bar) rather than just SEQ_SCAN(foo/bar). This doesn't affect any cases where automatically generated advice is supplied, since generated advice has always included the partition schema anyway. Manually written advice will have to conform to the new, stricter rule. For a later release, we can consider whether to again relax this restriction in some way, but now is not the time to design new things. Reported-by: Noah Misch <noah@leadboat.com> Backpatch-through: 19 Discussion: https://postgr.es/m/CA+TgmoYmXy-jiP5qDhqNEiYFEBzQsArO6O2d9E8szNZqi1bePQ@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/63920eb099ab7e0e9d9eb49a3aa392c9441d52ef Modified Files -------------- contrib/pg_plan_advice/README | 10 ++-- contrib/pg_plan_advice/expected/join_order.out | 8 +-- contrib/pg_plan_advice/expected/partitionwise.out | 60 +---------------------- contrib/pg_plan_advice/expected/syntax.out | 21 +++----- contrib/pg_plan_advice/pgpa_ast.c | 12 ++--- contrib/pg_plan_advice/pgpa_ast.h | 4 +- contrib/pg_plan_advice/pgpa_identifier.c | 31 +++++------- contrib/pg_plan_advice/pgpa_parser.y | 12 ++--- contrib/pg_plan_advice/pgpa_trove.c | 18 +++---- contrib/pg_plan_advice/sql/join_order.sql | 4 +- contrib/pg_plan_advice/sql/partitionwise.sql | 7 +-- contrib/pg_plan_advice/sql/syntax.sql | 7 +-- doc/src/sgml/pgplanadvice.sgml | 9 ++-- 13 files changed, 58 insertions(+), 145 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: pg_plan_advice: Disallow partition name without partition schema @ 2026-09-17 01:16 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2026-09-17 01:16 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_plan_advice: Disallow partition name without partition schema. Up until now, pg_plan_advice has had a feature that allows an advice target to mention a partition name but omit the partition schema; that is, something like SEQ_SCAN(foo/bar) forces a sequential scan on every child of table foo whose partition name is bar, regardless of the schema in which bar appears. However, that feature turns out to have a nasty design flaw: while advice enforcement handles this case just fine, the advice feedback code doesn't know about it and will mark such advice as "matched, failed" even when everything worked perfectly. Unfortunately, there seems to be no simple code fix for this problem. Since the release of PostgreSQL 19 is imminent, take the conservative course and revert this feature of pg_plan_advice. In other words, require the partition schema whenever the partition name is present. You must now write e.g. SEQ_SCAN(foo/public.bar) rather than just SEQ_SCAN(foo/bar). This doesn't affect any cases where automatically generated advice is supplied, since generated advice has always included the partition schema anyway. Manually written advice will have to conform to the new, stricter rule. For a later release, we can consider whether to again relax this restriction in some way, but now is not the time to design new things. Reported-by: Noah Misch <noah@leadboat.com> Backpatch-through: 19 Discussion: https://postgr.es/m/CA+TgmoYmXy-jiP5qDhqNEiYFEBzQsArO6O2d9E8szNZqi1bePQ@mail.gmail.com Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3201ea8f171a552b1a12e6c602a70f25252ba1cf Modified Files -------------- contrib/pg_plan_advice/README | 10 ++-- contrib/pg_plan_advice/expected/join_order.out | 8 +-- contrib/pg_plan_advice/expected/partitionwise.out | 60 +---------------------- contrib/pg_plan_advice/expected/syntax.out | 21 +++----- contrib/pg_plan_advice/pgpa_ast.c | 12 ++--- contrib/pg_plan_advice/pgpa_ast.h | 4 +- contrib/pg_plan_advice/pgpa_identifier.c | 31 +++++------- contrib/pg_plan_advice/pgpa_parser.y | 12 ++--- contrib/pg_plan_advice/pgpa_trove.c | 18 +++---- contrib/pg_plan_advice/sql/join_order.sql | 4 +- contrib/pg_plan_advice/sql/partitionwise.sql | 7 +-- contrib/pg_plan_advice/sql/syntax.sql | 7 +-- doc/src/sgml/pgplanadvice.sgml | 9 ++-- 13 files changed, 58 insertions(+), 145 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-09-17 01:16 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-17 01:16 pgsql: pg_plan_advice: Disallow partition name without partition schema Robert Haas <rhaas@postgresql.org> 2026-09-17 01:16 pgsql: pg_plan_advice: Disallow partition name without partition schema Robert Haas <rhaas@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox