pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. @ 2020-09-24 22:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-09-24 22:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of -d "connection string" in pg_dump/pg_restore. Parallel pg_dump failed if its -d parameter was a connection string containing any essential information other than host, port, or username. The same was true for pg_restore with --create. The reason is that these scenarios failed to preserve the connection string from the command line; the code felt free to replace that with just the database name when reconnecting from a pg_dump parallel worker or after creating the target database. By chance, parallel pg_restore did not suffer this defect, as long as you didn't say --create. In practice it seems that the error would be obvious only if the connstring included essential, non-default SSL or GSS parameters. This may explain why it took us so long to notice. (It also makes it very difficult to craft a regression test case illustrating the problem, since the test would fail in builds without those options.) Fix by refactoring so that ConnectDatabase always receives all the relevant options directly from the command line, rather than reconstructed values. Inject a different database name, when necessary, by relying on libpq's rules for handling multiple "dbname" parameters. While here, let's get rid of the essentially duplicate _connectDB function, as well as some obsolete nearby cruft. Per bug #16604 from Zsolt Ero. Back-patch to all supported branches. Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cb8885ac49697eb2568c4764ae3565cea52be92b Modified Files -------------- src/bin/pg_dump/pg_backup.h | 35 +++--- src/bin/pg_dump/pg_backup_archiver.c | 96 ++++---------- src/bin/pg_dump/pg_backup_archiver.h | 3 +- src/bin/pg_dump/pg_backup_db.c | 236 ++++++++++------------------------- src/bin/pg_dump/pg_dump.c | 24 ++-- src/bin/pg_dump/pg_restore.c | 16 +-- 6 files changed, 130 insertions(+), 280 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. @ 2020-09-24 22:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-09-24 22:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of -d "connection string" in pg_dump/pg_restore. Parallel pg_dump failed if its -d parameter was a connection string containing any essential information other than host, port, or username. The same was true for pg_restore with --create. The reason is that these scenarios failed to preserve the connection string from the command line; the code felt free to replace that with just the database name when reconnecting from a pg_dump parallel worker or after creating the target database. By chance, parallel pg_restore did not suffer this defect, as long as you didn't say --create. In practice it seems that the error would be obvious only if the connstring included essential, non-default SSL or GSS parameters. This may explain why it took us so long to notice. (It also makes it very difficult to craft a regression test case illustrating the problem, since the test would fail in builds without those options.) Fix by refactoring so that ConnectDatabase always receives all the relevant options directly from the command line, rather than reconstructed values. Inject a different database name, when necessary, by relying on libpq's rules for handling multiple "dbname" parameters. While here, let's get rid of the essentially duplicate _connectDB function, as well as some obsolete nearby cruft. Per bug #16604 from Zsolt Ero. Back-patch to all supported branches. Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/fb93f784fc9c31f12361462653d325fdce01207d Modified Files -------------- src/bin/pg_dump/pg_backup.h | 35 +++--- src/bin/pg_dump/pg_backup_archiver.c | 96 ++++---------- src/bin/pg_dump/pg_backup_archiver.h | 3 +- src/bin/pg_dump/pg_backup_db.c | 236 ++++++++++------------------------- src/bin/pg_dump/pg_dump.c | 24 ++-- src/bin/pg_dump/pg_restore.c | 16 +-- 6 files changed, 130 insertions(+), 280 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. @ 2020-09-24 22:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-09-24 22:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of -d "connection string" in pg_dump/pg_restore. Parallel pg_dump failed if its -d parameter was a connection string containing any essential information other than host, port, or username. The same was true for pg_restore with --create. The reason is that these scenarios failed to preserve the connection string from the command line; the code felt free to replace that with just the database name when reconnecting from a pg_dump parallel worker or after creating the target database. By chance, parallel pg_restore did not suffer this defect, as long as you didn't say --create. In practice it seems that the error would be obvious only if the connstring included essential, non-default SSL or GSS parameters. This may explain why it took us so long to notice. (It also makes it very difficult to craft a regression test case illustrating the problem, since the test would fail in builds without those options.) Fix by refactoring so that ConnectDatabase always receives all the relevant options directly from the command line, rather than reconstructed values. Inject a different database name, when necessary, by relying on libpq's rules for handling multiple "dbname" parameters. While here, let's get rid of the essentially duplicate _connectDB function, as well as some obsolete nearby cruft. Per bug #16604 from Zsolt Ero. Back-patch to all supported branches. Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/56b46d3a1a620548b4728b48bd28cdf11d88e101 Modified Files -------------- src/bin/pg_dump/pg_backup.h | 36 ++--- src/bin/pg_dump/pg_backup_archiver.c | 96 +++---------- src/bin/pg_dump/pg_backup_archiver.h | 3 +- src/bin/pg_dump/pg_backup_db.c | 254 +++++++++-------------------------- src/bin/pg_dump/pg_dump.c | 24 ++-- src/bin/pg_dump/pg_restore.c | 14 +- 6 files changed, 131 insertions(+), 296 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. @ 2020-09-24 22:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-09-24 22:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of -d "connection string" in pg_dump/pg_restore. Parallel pg_dump failed if its -d parameter was a connection string containing any essential information other than host, port, or username. The same was true for pg_restore with --create. The reason is that these scenarios failed to preserve the connection string from the command line; the code felt free to replace that with just the database name when reconnecting from a pg_dump parallel worker or after creating the target database. By chance, parallel pg_restore did not suffer this defect, as long as you didn't say --create. In practice it seems that the error would be obvious only if the connstring included essential, non-default SSL or GSS parameters. This may explain why it took us so long to notice. (It also makes it very difficult to craft a regression test case illustrating the problem, since the test would fail in builds without those options.) Fix by refactoring so that ConnectDatabase always receives all the relevant options directly from the command line, rather than reconstructed values. Inject a different database name, when necessary, by relying on libpq's rules for handling multiple "dbname" parameters. While here, let's get rid of the essentially duplicate _connectDB function, as well as some obsolete nearby cruft. Per bug #16604 from Zsolt Ero. Back-patch to all supported branches. Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/a45bc8a4f6495072bc48ad40a5aa0304979114f7 Modified Files -------------- src/bin/pg_dump/pg_backup.h | 35 +++--- src/bin/pg_dump/pg_backup_archiver.c | 96 ++++---------- src/bin/pg_dump/pg_backup_archiver.h | 3 +- src/bin/pg_dump/pg_backup_db.c | 237 ++++++++++------------------------- src/bin/pg_dump/pg_dump.c | 24 ++-- src/bin/pg_dump/pg_restore.c | 16 +-- 6 files changed, 130 insertions(+), 281 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. @ 2020-09-24 22:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-09-24 22:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of -d "connection string" in pg_dump/pg_restore. Parallel pg_dump failed if its -d parameter was a connection string containing any essential information other than host, port, or username. The same was true for pg_restore with --create. The reason is that these scenarios failed to preserve the connection string from the command line; the code felt free to replace that with just the database name when reconnecting from a pg_dump parallel worker or after creating the target database. By chance, parallel pg_restore did not suffer this defect, as long as you didn't say --create. In practice it seems that the error would be obvious only if the connstring included essential, non-default SSL or GSS parameters. This may explain why it took us so long to notice. (It also makes it very difficult to craft a regression test case illustrating the problem, since the test would fail in builds without those options.) Fix by refactoring so that ConnectDatabase always receives all the relevant options directly from the command line, rather than reconstructed values. Inject a different database name, when necessary, by relying on libpq's rules for handling multiple "dbname" parameters. While here, let's get rid of the essentially duplicate _connectDB function, as well as some obsolete nearby cruft. Per bug #16604 from Zsolt Ero. Back-patch to all supported branches. Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7c154f2fd246f7a5be40f3c6780b84e5eaba08de Modified Files -------------- src/bin/pg_dump/pg_backup.h | 36 ++--- src/bin/pg_dump/pg_backup_archiver.c | 96 +++---------- src/bin/pg_dump/pg_backup_archiver.h | 3 +- src/bin/pg_dump/pg_backup_db.c | 254 +++++++++-------------------------- src/bin/pg_dump/pg_dump.c | 24 ++-- src/bin/pg_dump/pg_restore.c | 14 +- 6 files changed, 131 insertions(+), 296 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. @ 2020-09-24 22:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-09-24 22:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of -d "connection string" in pg_dump/pg_restore. Parallel pg_dump failed if its -d parameter was a connection string containing any essential information other than host, port, or username. The same was true for pg_restore with --create. The reason is that these scenarios failed to preserve the connection string from the command line; the code felt free to replace that with just the database name when reconnecting from a pg_dump parallel worker or after creating the target database. By chance, parallel pg_restore did not suffer this defect, as long as you didn't say --create. In practice it seems that the error would be obvious only if the connstring included essential, non-default SSL or GSS parameters. This may explain why it took us so long to notice. (It also makes it very difficult to craft a regression test case illustrating the problem, since the test would fail in builds without those options.) Fix by refactoring so that ConnectDatabase always receives all the relevant options directly from the command line, rather than reconstructed values. Inject a different database name, when necessary, by relying on libpq's rules for handling multiple "dbname" parameters. While here, let's get rid of the essentially duplicate _connectDB function, as well as some obsolete nearby cruft. Per bug #16604 from Zsolt Ero. Back-patch to all supported branches. Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1738a61c8ffe42f987376d2e621d8d823345e1ef Modified Files -------------- src/bin/pg_dump/pg_backup.h | 36 +++--- src/bin/pg_dump/pg_backup_archiver.c | 96 ++++---------- src/bin/pg_dump/pg_backup_archiver.h | 3 +- src/bin/pg_dump/pg_backup_db.c | 236 ++++++++++------------------------- src/bin/pg_dump/pg_dump.c | 24 ++-- src/bin/pg_dump/pg_restore.c | 14 +-- 6 files changed, 130 insertions(+), 279 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. @ 2020-09-24 22:20 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2020-09-24 22:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of -d "connection string" in pg_dump/pg_restore. Parallel pg_dump failed if its -d parameter was a connection string containing any essential information other than host, port, or username. The same was true for pg_restore with --create. The reason is that these scenarios failed to preserve the connection string from the command line; the code felt free to replace that with just the database name when reconnecting from a pg_dump parallel worker or after creating the target database. By chance, parallel pg_restore did not suffer this defect, as long as you didn't say --create. In practice it seems that the error would be obvious only if the connstring included essential, non-default SSL or GSS parameters. This may explain why it took us so long to notice. (It also makes it very difficult to craft a regression test case illustrating the problem, since the test would fail in builds without those options.) Fix by refactoring so that ConnectDatabase always receives all the relevant options directly from the command line, rather than reconstructed values. Inject a different database name, when necessary, by relying on libpq's rules for handling multiple "dbname" parameters. While here, let's get rid of the essentially duplicate _connectDB function, as well as some obsolete nearby cruft. Per bug #16604 from Zsolt Ero. Back-patch to all supported branches. Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1888ff8d0d5ed018b4b557a1b92acc0327a81692 Modified Files -------------- src/bin/pg_dump/pg_backup.h | 36 ++--- src/bin/pg_dump/pg_backup_archiver.c | 96 +++----------- src/bin/pg_dump/pg_backup_archiver.h | 3 +- src/bin/pg_dump/pg_backup_db.c | 249 ++++++++++------------------------- src/bin/pg_dump/pg_dump.c | 24 ++-- src/bin/pg_dump/pg_restore.c | 14 +- 6 files changed, 131 insertions(+), 291 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2020-09-24 22:20 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-09-24 22:20 pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. Tom Lane <tgl@sss.pgh.pa.us> 2020-09-24 22:20 pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. Tom Lane <tgl@sss.pgh.pa.us> 2020-09-24 22:20 pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. Tom Lane <tgl@sss.pgh.pa.us> 2020-09-24 22:20 pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. Tom Lane <tgl@sss.pgh.pa.us> 2020-09-24 22:20 pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. Tom Lane <tgl@sss.pgh.pa.us> 2020-09-24 22:20 pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. Tom Lane <tgl@sss.pgh.pa.us> 2020-09-24 22:20 pgsql: Fix handling of -d "connection string" in pg_dump/pg_restore. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox