@@ -2930,8 +2930,16 @@ refreshMatViewData(Archive *fout, const TableDataInfo *tdinfo)
29302930
29312931 q = createPQExpBuffer();
29322932
2933- appendPQExpBuffer(q, "REFRESH MATERIALIZED VIEW %s;\n",
2934- fmtQualifiedDumpable(tbinfo));
2933+ if (tbinfo->isdynamic)
2934+ {
2935+ appendPQExpBuffer(q, "REFRESH DYNAMIC TABLE %s;\n",
2936+ fmtQualifiedDumpable(tbinfo));
2937+ }
2938+ else
2939+ {
2940+ appendPQExpBuffer(q, "REFRESH MATERIALIZED VIEW %s;\n",
2941+ fmtQualifiedDumpable(tbinfo));
2942+ }
29352943
29362944 if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA)
29372945 ArchiveEntry(fout,
@@ -2940,7 +2948,7 @@ refreshMatViewData(Archive *fout, const TableDataInfo *tdinfo)
29402948 ARCHIVE_OPTS(.tag = tbinfo->dobj.name,
29412949 .namespace = tbinfo->dobj.namespace->dobj.name,
29422950 .owner = tbinfo->rolname,
2943- .description = "MATERIALIZED VIEW DATA",
2951+ .description = tbinfo->isdynamic ? "DYNAMIC TABLE DATA": "MATERIALIZED VIEW DATA",
29442952 .section = SECTION_POST_DATA,
29452953 .createStmt = q->data,
29462954 .deps = tdinfo->dobj.dependencies,
@@ -7415,6 +7423,7 @@ getTables(Archive *fout, int *numTables)
74157423 int i_amname;
74167424 int i_amoid;
74177425 int i_isivm;
7426+ int i_isdynamic;
74187427
74197428 /*
74207429 * Find all the tables and table-like objects.
@@ -7535,7 +7544,8 @@ getTables(Archive *fout, int *numTables)
75357544 "%s AS partkeydef, "
75367545 "%s AS ispartition, "
75377546 "%s AS partbound, "
7538- "c.relisivm AS isivm "
7547+ "c.relisivm AS isivm, "
7548+ "c.relisdynamic AS isdynamic "
75397549 "FROM pg_class c "
75407550 "LEFT JOIN pg_depend d ON "
75417551 "(c.relkind = '%c' AND "
@@ -8106,6 +8116,7 @@ getTables(Archive *fout, int *numTables)
81068116 i_amname = PQfnumber(res, "amname");
81078117 i_amoid = PQfnumber(res, "amoid");
81088118 i_isivm = PQfnumber(res, "isivm");
8119+ i_isdynamic = PQfnumber(res, "isdynamic");
81098120
81108121 if (dopt->lockWaitTimeout)
81118122 {
@@ -8238,6 +8249,7 @@ getTables(Archive *fout, int *numTables)
82388249 tblinfo[i].ispartition = (strcmp(PQgetvalue(res, i, i_ispartition), "t") == 0);
82398250 tblinfo[i].partbound = pg_strdup(PQgetvalue(res, i, i_partbound));
82408251 tblinfo[i].isivm = (strcmp(PQgetvalue(res, i, i_isivm), "t") == 0);
8252+ tblinfo[i].isdynamic = (strcmp(PQgetvalue(res, i, i_isdynamic), "t") == 0);
82418253
82428254 /* foreign server */
82438255 tblinfo[i].foreign_server = atooid(PQgetvalue(res, i, i_foreignserver));
@@ -18081,7 +18093,10 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
1808118093 break;
1808218094 }
1808318095 case RELKIND_MATVIEW:
18084- reltypename = "MATERIALIZED VIEW";
18096+ if (tbinfo->isdynamic)
18097+ reltypename = "DYNAMIC TABLE";
18098+ else
18099+ reltypename = "MATERIALIZED VIEW";
1808518100 break;
1808618101 default:
1808718102 reltypename = "TABLE";
@@ -18154,14 +18169,22 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
1815418169 }
1815518170 }
1815618171
18157- appendPQExpBuffer(q, "CREATE %s%s%s %s",
18158- tbinfo->relpersistence == RELPERSISTENCE_UNLOGGED ?
18159- "UNLOGGED " : "",
18160- tbinfo->relkind == RELKIND_MATVIEW && tbinfo->isivm ?
18161- "INCREMENTAL " : "",
18162- reltypename,
18163- qualrelname);
18172+ if (tbinfo->relkind == RELKIND_MATVIEW && tbinfo->isdynamic)
18173+ {
18174+ /* We'r sure there is no UNLOGGED and this is a DYNAMIC TABLE. */
18175+ appendPQExpBuffer(q, "CREATE DYNAMIC TABLE %s", qualrelname);
18176+ }
18177+ else
18178+ {
18179+ appendPQExpBuffer(q, "CREATE %s%s%s %s",
18180+ tbinfo->relpersistence == RELPERSISTENCE_UNLOGGED ?
18181+ "UNLOGGED " : "",
18182+ tbinfo->relkind == RELKIND_MATVIEW && tbinfo->isivm ?
18183+ "INCREMENTAL " : "",
18184+ reltypename,
18185+ qualrelname);
1816418186
18187+ }
1816518188 /*
1816618189 * Attach to type, if reloftype; except in case of a binary upgrade,
1816718190 * we dump the table normally and attach it to the type afterward.
0 commit comments