postgresql/src/bin
Michael Paquier f46bee346c Fix dumps of partitioned tables with table AMs
pg_dump/restore failed to properly set the table access method for
partitioned tables, as it relies on SET queries that would change
default_table_access_method.  However, SET affects only tables and
materialized views, not partitioned tables which would always be
restored with their pg_class.relam set to 0, losing their table AM set
by either a CREATE TABLE .. USING or by a ALTER TABLE .. SET ACCESS
METHOD.

Appending a USING clause to the definition of CREATE TABLE is not
possible as users may specify --no-table-access-method at restore or for
a dump, meaning that the table AM portions may have to be skipped.
Rather than SET, the solution used by this commit is to generate an
extra ALTER TABLE .. SET ACCESS METHOD when restoring a partitioned
table, based on the table AM set in its TOC entry.  The choice of using
a SET query or an ALTER TABLE query for a relation requires the addition
of the relkind to the TOC entry to be able to choose between one or the
other.  Note that using ALTER TABLE SET ACCESS METHOD on a relation with
physical storage would require a full rewrite, which would be costly for
one.  This also creates problems with binary upgrades where the rewrite
would not be able to keep the OID of the relation consistent across the
upgrade.

This commit would normally require a protocol bump, but a45c78e328 has
already done one for this release cycle.

Regression tests are adjusted with the new expected output, with some
tweaks for the table AMs of the partitions to make the output more
readable.

Issue introduced by 374c7a2290, that has added support for table AMs
in partitioned tables.

Author: Michael Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/Zh4JLSvvtQgBJZkZ@paquier.xyz
2024-04-22 15:15:36 +09:00
..
initdb Fix test failures when language environment is not UTF-8. 2024-04-04 16:10:12 -07:00
pg_amcheck Support retrieval of results in chunks with libpq. 2024-04-06 20:45:11 -04:00
pg_archivecleanup Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings 2024-03-19 07:09:31 +01:00
pg_basebackup Revert recent ill-advised test case changes. 2024-04-19 17:21:56 -04:00
pg_checksums Skip .DS_Store files in server side utils 2024-02-13 13:47:12 +01:00
pg_combinebackup Revert recent ill-advised test case changes. 2024-04-19 17:21:56 -04:00
pg_config Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_controldata Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_ctl Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings 2024-03-19 07:09:31 +01:00
pg_dump Fix dumps of partitioned tables with table AMs 2024-04-22 15:15:36 +09:00
pg_resetwal Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings 2024-03-19 07:09:31 +01:00
pg_rewind Convert uses of hash_string_pointer to fasthash equivalent 2024-04-06 12:20:40 +07:00
pg_test_fsync Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_test_timing Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_upgrade Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
pg_verifybackup Don't allocate large buffer on the stack in pg_verifybackup 2024-04-12 10:52:25 -04:00
pg_waldump Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_walsummary Add missing set_pglocale_pgservice() for pg_walsummary and pg_combinebackup 2024-04-09 14:01:33 +09:00
pgbench Adjust pgbench option for debug mode. 2024-03-25 11:08:53 -05:00
pgevent Update copyright for 2024 2024-01-03 20:49:05 -05:00
psql psql: Make output of \dD more stable 2024-04-15 09:28:48 +02:00
scripts createdb: compare strategy case-insensitive 2024-04-21 21:21:26 +02:00
Makefile Add new pg_walsummary tool. 2024-01-11 12:48:27 -05:00
meson.build Add new pg_walsummary tool. 2024-01-11 12:48:27 -05:00