pg_dump: Emit ONLY before table added to publication
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 17 Apr 2017 13:47:39 +0000 (09:47 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 17 Apr 2017 13:51:53 +0000 (09:51 -0400)
This is necessary to be able to reproduce publication membership
correctly if tables are involved in inheritance.

Author: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>

src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/t/002_pg_dump.pl

index 3eccfa626bf311850897cdb1c231298aaa5b8485..22b5f784dc02b2db8e6367e46e27814ee189ff31 100644 (file)
@@ -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));
index 4dd208e8e1111978504d09a61b84b79106a54bc5..ccd0ed6a539b2db6506fb20ed8c0539b27649492 100644 (file)
@@ -4423,7 +4423,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
        create_sql =>
          'ALTER PUBLICATION pub1 ADD TABLE 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,
@@ -4457,7 +4457,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
        create_sql =>
          'ALTER PUBLICATION pub1 ADD TABLE 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,