Do not dump TO NODE clause for partition or child table
authorPavan Deolasee <pavan.deolasee@gmail.com>
Fri, 27 Jul 2018 12:19:38 +0000 (17:49 +0530)
committerPavan Deolasee <pavan.deolasee@gmail.com>
Fri, 27 Jul 2018 12:21:13 +0000 (17:51 +0530)
We missed this in the commit c168cc8d58c6e0d9710ef0aba1b846b7174e0a79. So deal
with it now.

src/bin/pg_dump/pg_dump.c

index ab80835150cc4377cff6b4e2592cf329268a520f..9dada8f2d4ea8a9ac216996cbd611fcb5c65048b 100644 (file)
@@ -15213,39 +15213,42 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                         * partiion table, in which case the information is derived from
                         * the parent table.
                         */
-                       if (tbinfo->pgxclocatortype != 'E' && !tbinfo->ispartition &&
-                               numParents == 0)
+                       if (!tbinfo->ispartition && numParents == 0)
                        {
-                               /* N: DISTRIBUTE BY ROUNDROBIN */
-                               if (tbinfo->pgxclocatortype == 'N')
+                               if (tbinfo->pgxclocatortype != 'E')
                                {
-                                       appendPQExpBuffer(q, "\nDISTRIBUTE BY ROUNDROBIN");
-                               }
-                               /* R: DISTRIBUTE BY REPLICATED */
-                               else if (tbinfo->pgxclocatortype == 'R')
-                               {
-                                       appendPQExpBuffer(q, "\nDISTRIBUTE BY REPLICATION");
-                               }
-                               /* H: DISTRIBUTE BY HASH  */
-                               else if (tbinfo->pgxclocatortype == 'H')
-                               {
-                                       int hashkey = tbinfo->pgxcattnum;
-                                       appendPQExpBuffer(q, "\nDISTRIBUTE BY HASH (%s)",
-                                                                         fmtId(tbinfo->attnames[hashkey - 1]));
+                                       /* N: DISTRIBUTE BY ROUNDROBIN */
+                                       if (tbinfo->pgxclocatortype == 'N')
+                                       {
+                                               appendPQExpBuffer(q, "\nDISTRIBUTE BY ROUNDROBIN");
+                                       }
+                                       /* R: DISTRIBUTE BY REPLICATED */
+                                       else if (tbinfo->pgxclocatortype == 'R')
+                                       {
+                                               appendPQExpBuffer(q, "\nDISTRIBUTE BY REPLICATION");
+                                       }
+                                       /* H: DISTRIBUTE BY HASH  */
+                                       else if (tbinfo->pgxclocatortype == 'H')
+                                       {
+                                               int hashkey = tbinfo->pgxcattnum;
+                                               appendPQExpBuffer(q, "\nDISTRIBUTE BY HASH (%s)",
+                                                                                 fmtId(tbinfo->attnames[hashkey - 1]));
+                                       }
+                                       else if (tbinfo->pgxclocatortype == 'M')
+                                       {
+                                               int hashkey = tbinfo->pgxcattnum;
+                                               appendPQExpBuffer(q, "\nDISTRIBUTE BY MODULO (%s)",
+                                                                                 fmtId(tbinfo->attnames[hashkey - 1]));
+                                       }
                                }
-                               else if (tbinfo->pgxclocatortype == 'M')
+                               if (include_nodes &&
+                                               tbinfo->pgxc_node_names != NULL &&
+                                               tbinfo->pgxc_node_names[0] != '\0')
                                {
-                                       int hashkey = tbinfo->pgxcattnum;
-                                       appendPQExpBuffer(q, "\nDISTRIBUTE BY MODULO (%s)",
-                                                                         fmtId(tbinfo->attnames[hashkey - 1]));
+                                       appendPQExpBuffer(q, "\nTO NODE (%s)", tbinfo->pgxc_node_names);
                                }
                        }
-                       if (include_nodes &&
-                               tbinfo->pgxc_node_names != NULL &&
-                               tbinfo->pgxc_node_names[0] != '\0')
-                       {
-                               appendPQExpBuffer(q, "\nTO NODE (%s)", tbinfo->pgxc_node_names);
-                       }
+
                }
 #endif
                /* Dump generic options if any */