pgsql: gen_guc_tables.pl: Improve detection of inconsistent data

2026-03-17 Thread Michael Paquier
gen_guc_tables.pl: Improve detection of inconsistent data This commit adds two improvements to gen_guc_tables.pl: 1) When finding two entries with the same name, the script complained about these being not in alphabetical order, which was confusing. Duplicated entries are now reported as their own

pgsql: pg_dump: Add appropriate version check

2026-03-17 Thread Peter Eisentraut
pg_dump: Add appropriate version check Some code added by commit 2f094e7ac69 needs to be behind a version check so that it is not run against older databases. Author: Andrew Dunstan Reviewed-by: Junwang Zhao Discussion: https://www.postgresql.org/message-id/afe3f099-3271-4fc4-8e32-467b5309affb

pgsql: Don't leave behind files in src dir in 007_multixact_conversion.

2026-03-17 Thread Heikki Linnakangas
Don't leave behind files in src dir in 007_multixact_conversion.pl pg_upgrade test 007_multixact_conversion.pl was leaving files like delete_old_cluster.sh in the source directory for VPATH and meson builds. To fix, change the tmp_check directory before running the test, like in the other pg_upgra

pgsql: Dump labels in reproducible order

2026-03-17 Thread Peter Eisentraut
Dump labels in reproducible order In pg_get_propgraphdef(), sort the labels before writing out, for a consistent dump order. Also, since we now have a list, we can get rid of the separate table scan to get the count. Co-authored-by: Peter Eisentraut Co-authored-by: Ashutosh Bapat Co-authored-b

pgsql: pg_plan_advice: Always install pg_plan_advice.h, and in the righ

2026-03-17 Thread Robert Haas
pg_plan_advice: Always install pg_plan_advice.h, and in the right place The Makefile failed to set HEADERS_pg_plan_advice, so the header wasn't installed. Fixing that reveals another problem: since this is just a loadable module, not an extension, the header file is installed into $(includedir_ser

pgsql: test_plan_advice: Add .gitignore

2026-03-17 Thread Michael Paquier
test_plan_advice: Add .gitignore Issue noticed while playing with the tree. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ab697307dd0f0b4f6c6671421d4dd0bc20f176cb Modified Files -- src/test/modules/test_plan_advice/.gitignore | 4 1 file changed,

pgsql: Move planner row-estimation tests to new planner_est.sql

2026-03-17 Thread David Rowley
Move planner row-estimation tests to new planner_est.sql Move explain_mask_costs() and the associated planner row-estimation tests from misc_functions.sql to a new regression test file, planner_est.sql. Previously, there wasn't an ideal home for such tests, likely as there were very few such test

pgsql: make immutability tests in to_json and to_jsonb complete

2026-03-17 Thread Andrew Dunstan
make immutability tests in to_json and to_jsonb complete Complete the TODOs in to_json_is_immutable() and to_jsonb_is_immutable() by recursing into container types (arrays, composites, ranges, multiranges, domains) to check element/sub-type mutability, rather than conservatively returning "mutable

pgsql: Fix use of wrong variable in _hash_kill_items()

2026-03-17 Thread Andres Freund
Fix use of wrong variable in _hash_kill_items() In 82467f627bd I somehow ended up using 'so->currPos.buf' instead of the 'buf' variable, which is incorrect when the buffer is not already pinned. At the very least this can lead to assertion failures Unfortunately this shows that this code path was

pgsql: Allow IS JSON predicate to work with domain types

2026-03-17 Thread Andrew Dunstan
Allow IS JSON predicate to work with domain types The IS JSON predicate only accepted the base types text, json, jsonb, and bytea. Extend it to also accept domain types over those base types by resolving through getBaseType() during parse analysis. The base type OID is stored in the JsonIsPredic

pgsql: Test pg_plan_advice using a new test_plan_advice module.

2026-03-17 Thread Robert Haas
Test pg_plan_advice using a new test_plan_advice module. The TAP test included in this new module runs the regression tests with pg_plan_advice loaded. It arranges for each query to be planned twice. The first time, we generate plan advice. The second time, we replan the query using the resulting

pgsql: pg_plan_advice: Fix variable type confusion.

2026-03-17 Thread Robert Haas
pg_plan_advice: Fix variable type confusion. pgs_mask values should always be uint64, but in a couple of places I incorrectly used uint32. Fix that. Reported-by: David Rowley Discussion: http://postgr.es/m/caaphdvquh6wnp4fhpacokc4r3kavr2botbhhdpdqcbnr3yb...@mail.gmail.com Branch -- master

pgsql: Hardcode typeof_unqual to __typeof_unqual__ for clang

2026-03-17 Thread Peter Eisentraut
Hardcode typeof_unqual to __typeof_unqual__ for clang A new attempt was made in 63275ce84d2 to make typeof_unqual work on all configurations of CC and CLANG. This re-introduced an old problem though, where CLANG would only support __typeof_unqual__ but the configure check for CC detected support f

pgsql: Add more columns to pg_stats, pg_stats_ext, and pg_stats_ext_exp

2026-03-17 Thread Nathan Bossart
Add more columns to pg_stats, pg_stats_ext, and pg_stats_ext_exprs. This commit adds table OID and attribute number columns to pg_stats, and it adds table OID and statistics object OID columns to pg_stats_ext and pg_stats_ext_exprs. A proposed follow-up commit would use pg_stats.tableid to simpli

pgsql: pg_dump: Simplify query for retrieving attribute statistics.

2026-03-17 Thread Nathan Bossart
pg_dump: Simplify query for retrieving attribute statistics. This query fetches information from pg_stats, which did not return table OIDs until recent commit 3b88e50d6c. Because of this, we had to cart around arrays of schema and table names, and we needed an extra filter clause to hopefully con

pgsql: pg_plan_advice: Avoid a crash under GEQO.

2026-03-17 Thread Robert Haas
pg_plan_advice: Avoid a crash under GEQO. The previous code could allocate pgpa_sj_unique_rel objects in a context that had too short a lifespan. Fix by allocating them (and any associated List-related allocations) in the same context as the pgpa_planner_state to which they are attached. We also n