From da6335c1727be7d2a12c225842baa64b9bc4a24a Mon Sep 17 00:00:00 2001 From: amit Date: Mon, 17 Apr 2017 11:35:02 +0900 Subject: [PATCH 1/2] Make pg_dump emit ONLY before table added to publication --- src/bin/pg_dump/pg_dump.c | 2 +- src/bin/pg_dump/t/002_pg_dump.pl | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 3eccfa626b..22b5f784dc 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -3627,7 +3627,7 @@ dumpPublicationTable(Archive *fout, PublicationRelInfo *pubrinfo) query = createPQExpBuffer(); - appendPQExpBuffer(query, "ALTER PUBLICATION %s ADD TABLE", + appendPQExpBuffer(query, "ALTER PUBLICATION %s ADD TABLE ONLY", fmtId(pubrinfo->pubname)); appendPQExpBuffer(query, " %s;", fmtId(tbinfo->dobj.name)); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 4dd208e8e1..b2f4ab6baf 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -4417,13 +4417,13 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog section_pre_data => 1, test_schema_plus_blobs => 1, }, }, - 'ALTER PUBLICATION pub1 ADD TABLE test_table' => { + 'ALTER PUBLICATION pub1 ADD TABLE ONLY test_table' => { all_runs => 1, create_order => 51, create_sql => - 'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_table;', + 'ALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_table;', regexp => qr/^ - \QALTER PUBLICATION pub1 ADD TABLE test_table;\E + \QALTER PUBLICATION pub1 ADD TABLE ONLY test_table;\E /xm, like => { binary_upgrade => 1, @@ -4452,12 +4452,12 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog pg_dumpall_globals => 1, pg_dumpall_globals_clean => 1, test_schema_plus_blobs => 1, }, }, - 'ALTER PUBLICATION pub1 ADD TABLE test_second_table' => { + 'ALTER PUBLICATION pub1 ADD TABLE ONLY test_second_table' => { create_order => 52, create_sql => - 'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_second_table;', + 'ALTER PUBLICATION pub1 ADD TABLE ONLY dump_test.test_second_table;', regexp => qr/^ - \QALTER PUBLICATION pub1 ADD TABLE test_second_table;\E + \QALTER PUBLICATION pub1 ADD TABLE ONLY test_second_table;\E /xm, like => { binary_upgrade => 1, -- 2.11.0