Do not dump TO NODE clause for partition or child table
authorPavan Deolasee <[email protected]>
Fri, 27 Jul 2018 12:19:38 +0000 (17:49 +0530)
committerPavan Deolasee <[email protected]>
Tue, 31 Jul 2018 07:07:26 +0000 (12:37 +0530)
We missed this in the commit c168cc8d58c6e0d9710ef0aba1b846b7174e0a79. So deal
with it now.

src/bin/pg_dump/pg_dump.c

index 55ae1cde2a2875a46d02460da97695d8a3bc44e1..691c9194271b5765f0cc51455cc1bf90b8d0c6d3 100644 (file)
@@ -15498,39 +15498,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 */