postgresql/src/bin/pg_dump
Tom Lane e2ff7d9a83 Make pg_dump acquire lock on partitioned tables that are to be dumped.
It was clearly the intent to do so all along, but the original coding
fat-fingered this by checking the wrong array element.  We fixed it
in passing in 403a3d91c, but that later got reverted, and we forgot
to keep this bug fix.

Most of the time this'd be relatively harmless, since once we lock
any of the partitioned table's leaf partitions, that would suffice
to prevent major DDL on the partitioned table itself.  However, a
childless partitioned table would get dumped with no relevant lock
whatsoever, possibly allowing dump failure or inconsistent output.

Unlike 403a3d91c, there are no versioning concerns, since every server
version that has partitioned tables will allow you to lock one.

Back-patch to v10 where partitioned tables were introduced.

Discussion: https://postgr.es/m/1018205.1634346327@sss.pgh.pa.us
2021-10-16 12:23:57 -04:00
..
po Translation updates 2021-06-21 12:33:50 +02:00
t Revoke PUBLIC CREATE from public schema, now owned by pg_database_owner. 2021-09-09 23:38:09 -07:00
.gitignore Clean up after pg_dump test runs. 2016-05-06 22:28:01 -04:00
common.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
compress_io.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
compress_io.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
dumputils.c Dump public schema ownership and security labels. 2021-06-28 18:34:55 -07:00
dumputils.h Dump public schema ownership and security labels. 2021-06-28 18:34:55 -07:00
Makefile Update copyright for 2021 2021-01-02 13:06:25 -05:00
nls.mk Translation updates 2021-05-10 14:36:21 +02:00
parallel.c Factor out system call names from error messages 2021-04-23 14:21:37 +02:00
parallel.h Add missing header declarations for pg_basebackup and pg_{dump,restore} 2021-07-24 19:05:14 +09:00
pg_backup.h Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
pg_backup_archiver.c Dump public schema ownership and security labels. 2021-06-28 18:34:55 -07:00
pg_backup_archiver.h Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
pg_backup_custom.c Yet more elimination of dead stores and useless initializations. 2020-09-05 13:17:32 -04:00
pg_backup_db.c Avoid redundantly prefixing PQerrorMessage for a connection failure. 2021-01-22 16:52:31 -05:00
pg_backup_db.h Revert "pg_dump: Lock all relations, not just plain tables". 2020-11-06 15:48:04 -05:00
pg_backup_directory.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_backup_null.c Remove useless "return;" lines 2019-11-28 16:48:37 -03:00
pg_backup_tar.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
pg_backup_tar.h Fix tar files emitted by pg_dump and pg_basebackup to be POSIX conformant. 2012-09-28 15:19:15 -04:00
pg_backup_utils.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_backup_utils.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_dump.c Make pg_dump acquire lock on partitioned tables that are to be dumped. 2021-10-16 12:23:57 -04:00
pg_dump.h Cache the results of format_type() queries in pg_dump. 2021-08-31 13:53:49 -04:00
pg_dump_sort.c Dump ALTER TABLE ... ATTACH PARTITION as a separate ArchiveEntry. 2021-01-11 21:09:18 -05:00
pg_dumpall.c Add --no-toast-compression to pg_dumpall 2021-05-19 09:38:48 +09:00
pg_restore.c Unify parsing logic for command-line integer options 2021-07-24 18:35:03 +09:00