]> granicus.if.org Git - postgresql/commitdiff
pg_dump: Fix dumping of publications
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 10 Mar 2017 20:31:47 +0000 (15:31 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 10 Mar 2017 20:31:47 +0000 (15:31 -0500)
Dumping a publication with more than one table crashed pg_dump.

patch by Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, test by me

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

index 073654e94b5f2096ebd4739deae400915ef93736..e67171dccbf050a4a356a58a8b904e90e24acdc6 100644 (file)
@@ -3557,6 +3557,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
                        pubrinfo[j].dobj.catId.oid = atooid(PQgetvalue(res, j, i_oid));
                        AssignDumpId(&pubrinfo[j].dobj);
                        pubrinfo[j].dobj.namespace = tbinfo->dobj.namespace;
+                       pubrinfo[j].dobj.name = tbinfo->dobj.name;
                        pubrinfo[j].pubname = pg_strdup(PQgetvalue(res, j, i_pubname));
                        pubrinfo[j].pubtable = tbinfo;
                }
index b554dcd55ec6b4bb54436c0c977921000108ee61..a2322a9acc064e1ab52585ebd0636d0b6fec8fc8 100644 (file)
@@ -2286,6 +2286,34 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
                        exclude_test_table       => 1,
                        pg_dumpall_globals       => 1,
                        pg_dumpall_globals_clean => 1, }, },
+       'ALTER PUBLICATION pub1 ADD TABLE test_second_table' => {
+               create_order => 52,
+               create_sql =>
+                 'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_second_table;',
+               regexp => qr/^
+                       \QALTER PUBLICATION pub1 ADD TABLE test_second_table;\E
+                       /xm,
+               like => {
+                       binary_upgrade          => 1,
+                       clean                   => 1,
+                       clean_if_exists         => 1,
+                       createdb                => 1,
+                       defaults                => 1,
+                       exclude_test_table      => 1,
+                       exclude_test_table_data => 1,
+                       no_privs                => 1,
+                       no_owner                => 1,
+                       only_dump_test_schema   => 1,
+                       pg_dumpall_dbprivs      => 1,
+                       schema_only             => 1,
+                       section_post_data       => 1,
+                       test_schema_plus_blobs  => 1, },
+               unlike => {
+                       section_pre_data         => 1,
+                       exclude_dump_test_schema => 1,
+                       only_dump_test_table     => 1,
+                       pg_dumpall_globals       => 1,
+                       pg_dumpall_globals_clean => 1, }, },
 
        'CREATE SCHEMA dump_test' => {
                all_runs     => 1,