Do not dump DISTRIBUTED BY for partition and inherited table
authorPavan Deolasee <[email protected]>
Fri, 27 Jul 2018 06:59:13 +0000 (12:29 +0530)
committerPavan Deolasee <[email protected]>
Fri, 27 Jul 2018 08:01:38 +0000 (13:31 +0530)
Child tables inherit the distribition property from the parent table. Even
more, XL doesn't support a syntax of the form PARTITION OF .. DISTRIBUTED BY
and doesn't allow child tables to have a distribution property different than
the parent. So attaching this clause to the partition table does not make any
sense.

Per report from Virendra Kumar.

src/bin/pg_dump/pg_dump.c

index 3e5213bfc5445ab655b2151c829427bfb3b9bea8..545106baeef4f2bf5196bd21a6da64c14b909478 100644 (file)
@@ -15493,8 +15493,13 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
 #ifdef PGXC
                if (fout->isPostgresXL)
                {
-                       /* Add the grammar extension linked to PGXC depending on data got from pgxc_class */
-                       if (tbinfo->pgxclocatortype != 'E')
+                       /*
+                        * Add table distribution syntax, unless we're dealing with a
+                        * partiion table, in which case the information is derived from
+                        * the parent table.
+                        */
+                       if (tbinfo->pgxclocatortype != 'E' && !tbinfo->ispartition &&
+                               numParents == 0)
                        {
                                /* N: DISTRIBUTE BY ROUNDROBIN */
                                if (tbinfo->pgxclocatortype == 'N')