@@ -6874,7 +6874,8 @@ getFuncs(Archive *fout)
6874
6874
*/
6875
6875
static RelStatsInfo *
6876
6876
getRelationStatistics(Archive *fout, DumpableObject *rel, int32 relpages,
6877
- char *reltuples, int32 relallvisible, char relkind,
6877
+ char *reltuples, int32 relallvisible,
6878
+ int32 relallfrozen, char relkind,
6878
6879
char **indAttNames, int nindAttNames)
6879
6880
{
6880
6881
if (!fout->dopt->dumpStatistics)
@@ -6903,6 +6904,7 @@ getRelationStatistics(Archive *fout, DumpableObject *rel, int32 relpages,
6903
6904
info->relpages = relpages;
6904
6905
info->reltuples = pstrdup(reltuples);
6905
6906
info->relallvisible = relallvisible;
6907
+ info->relallfrozen = relallfrozen;
6906
6908
info->relkind = relkind;
6907
6909
info->indAttNames = indAttNames;
6908
6910
info->nindAttNames = nindAttNames;
@@ -6967,6 +6969,7 @@ getTables(Archive *fout, int *numTables)
6967
6969
int i_relpages;
6968
6970
int i_reltuples;
6969
6971
int i_relallvisible;
6972
+ int i_relallfrozen;
6970
6973
int i_toastpages;
6971
6974
int i_owning_tab;
6972
6975
int i_owning_col;
@@ -7017,8 +7020,15 @@ getTables(Archive *fout, int *numTables)
7017
7020
"c.relowner, "
7018
7021
"c.relchecks, "
7019
7022
"c.relhasindex, c.relhasrules, c.relpages, "
7020
- "c.reltuples, c.relallvisible, c.relhastriggers, "
7021
- "c.relpersistence, "
7023
+ "c.reltuples, c.relallvisible, ");
7024
+
7025
+ if (fout->remoteVersion >= 180000)
7026
+ appendPQExpBufferStr(query, "c.relallfrozen, ");
7027
+ else
7028
+ appendPQExpBufferStr(query, "0 AS relallfrozen, ");
7029
+
7030
+ appendPQExpBufferStr(query,
7031
+ "c.relhastriggers, c.relpersistence, "
7022
7032
"c.reloftype, "
7023
7033
"c.relacl, "
7024
7034
"acldefault(CASE WHEN c.relkind = " CppAsString2(RELKIND_SEQUENCE)
@@ -7183,6 +7193,7 @@ getTables(Archive *fout, int *numTables)
7183
7193
i_relpages = PQfnumber(res, "relpages");
7184
7194
i_reltuples = PQfnumber(res, "reltuples");
7185
7195
i_relallvisible = PQfnumber(res, "relallvisible");
7196
+ i_relallfrozen = PQfnumber(res, "relallfrozen");
7186
7197
i_toastpages = PQfnumber(res, "toastpages");
7187
7198
i_owning_tab = PQfnumber(res, "owning_tab");
7188
7199
i_owning_col = PQfnumber(res, "owning_col");
@@ -7230,6 +7241,7 @@ getTables(Archive *fout, int *numTables)
7230
7241
for (i = 0; i < ntups; i++)
7231
7242
{
7232
7243
int32 relallvisible = atoi(PQgetvalue(res, i, i_relallvisible));
7244
+ int32 relallfrozen = atoi(PQgetvalue(res, i, i_relallfrozen));
7233
7245
7234
7246
tblinfo[i].dobj.objType = DO_TABLE;
7235
7247
tblinfo[i].dobj.catId.tableoid = atooid(PQgetvalue(res, i, i_reltableoid));
@@ -7336,7 +7348,7 @@ getTables(Archive *fout, int *numTables)
7336
7348
stats = getRelationStatistics(fout, &tblinfo[i].dobj,
7337
7349
tblinfo[i].relpages,
7338
7350
PQgetvalue(res, i, i_reltuples),
7339
- relallvisible,
7351
+ relallvisible, relallfrozen,
7340
7352
tblinfo[i].relkind, NULL, 0);
7341
7353
if (tblinfo[i].relkind == RELKIND_MATVIEW)
7342
7354
tblinfo[i].stats = stats;
@@ -7609,6 +7621,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
7609
7621
i_relpages,
7610
7622
i_reltuples,
7611
7623
i_relallvisible,
7624
+ i_relallfrozen,
7612
7625
i_parentidx,
7613
7626
i_indexdef,
7614
7627
i_indnkeyatts,
@@ -7663,7 +7676,14 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
7663
7676
appendPQExpBufferStr(query,
7664
7677
"SELECT t.tableoid, t.oid, i.indrelid, "
7665
7678
"t.relname AS indexname, "
7666
- "t.relpages, t.reltuples, t.relallvisible, "
7679
+ "t.relpages, t.reltuples, t.relallvisible, ");
7680
+
7681
+ if (fout->remoteVersion >= 180000)
7682
+ appendPQExpBufferStr(query, "t.relallfrozen, ");
7683
+ else
7684
+ appendPQExpBufferStr(query, "0 AS relallfrozen, ");
7685
+
7686
+ appendPQExpBufferStr(query,
7667
7687
"pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
7668
7688
"i.indkey, i.indisclustered, "
7669
7689
"c.contype, c.conname, "
@@ -7779,6 +7799,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
7779
7799
i_relpages = PQfnumber(res, "relpages");
7780
7800
i_reltuples = PQfnumber(res, "reltuples");
7781
7801
i_relallvisible = PQfnumber(res, "relallvisible");
7802
+ i_relallfrozen = PQfnumber(res, "relallfrozen");
7782
7803
i_parentidx = PQfnumber(res, "parentidx");
7783
7804
i_indexdef = PQfnumber(res, "indexdef");
7784
7805
i_indnkeyatts = PQfnumber(res, "indnkeyatts");
@@ -7850,6 +7871,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
7850
7871
RelStatsInfo *relstats;
7851
7872
int32 relpages = atoi(PQgetvalue(res, j, i_relpages));
7852
7873
int32 relallvisible = atoi(PQgetvalue(res, j, i_relallvisible));
7874
+ int32 relallfrozen = atoi(PQgetvalue(res, j, i_relallfrozen));
7853
7875
7854
7876
indxinfo[j].dobj.objType = DO_INDEX;
7855
7877
indxinfo[j].dobj.catId.tableoid = atooid(PQgetvalue(res, j, i_tableoid));
@@ -7892,7 +7914,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
7892
7914
7893
7915
relstats = getRelationStatistics(fout, &indxinfo[j].dobj, relpages,
7894
7916
PQgetvalue(res, j, i_reltuples),
7895
- relallvisible, indexkind,
7917
+ relallvisible, relallfrozen, indexkind,
7896
7918
indAttNames, nindAttNames);
7897
7919
7898
7920
contype = *(PQgetvalue(res, j, i_contype));
@@ -10618,9 +10640,15 @@ dumpRelationStats(Archive *fout, const RelStatsInfo *rsinfo)
10618
10640
appendPQExpBufferStr(out, ",\n");
10619
10641
appendPQExpBuffer(out, "\t'relpages', '%d'::integer,\n", rsinfo->relpages);
10620
10642
appendPQExpBuffer(out, "\t'reltuples', '%s'::real,\n", rsinfo->reltuples);
10621
- appendPQExpBuffer(out, "\t'relallvisible', '%d'::integer\n);\n ",
10643
+ appendPQExpBuffer(out, "\t'relallvisible', '%d'::integer",
10622
10644
rsinfo->relallvisible);
10623
10645
10646
+ if (fout->remoteVersion >= 180000)
10647
+ appendPQExpBuffer(out, ",\n\t'relallfrozen', '%d'::integer", rsinfo->relallfrozen);
10648
+
10649
+ appendPQExpBufferStr(out, "\n);\n");
10650
+
10651
+
10624
10652
/* fetch attribute stats */
10625
10653
appendPQExpBufferStr(query, "EXECUTE getAttributeStats(");
10626
10654
appendStringLiteralAH(query, dobj->namespace->dobj.name, fout);
0 commit comments