Commit a18b72ad authored by Kevin Grittner's avatar Kevin Grittner

Fix bug in dumping prior releases due to MV REFRESH dependency checking.

Reports and suggested patches from Fujii Masao and Andrew Dunstan.

Andrew Dunstan
parent ed3ddf91
...@@ -1769,7 +1769,7 @@ makeTableDataInfo(TableInfo *tbinfo, bool oids) ...@@ -1769,7 +1769,7 @@ makeTableDataInfo(TableInfo *tbinfo, bool oids)
static void static void
buildMatViewRefreshDependencies(Archive *fout) buildMatViewRefreshDependencies(Archive *fout)
{ {
PQExpBuffer query = createPQExpBuffer(); PQExpBuffer query;
PGresult *res; PGresult *res;
int ntups, int ntups,
i; i;
...@@ -1777,11 +1777,15 @@ buildMatViewRefreshDependencies(Archive *fout) ...@@ -1777,11 +1777,15 @@ buildMatViewRefreshDependencies(Archive *fout)
i_objid, i_objid,
i_refobjid; i_refobjid;
/* No Mat Views before 9.3. */
if (fout->remoteVersion < 90300)
return;
/* Make sure we are in proper schema */ /* Make sure we are in proper schema */
selectSourceSchema(fout, "pg_catalog"); selectSourceSchema(fout, "pg_catalog");
if (fout->remoteVersion >= 90300) query = createPQExpBuffer();
{
appendPQExpBuffer(query, "with recursive w as " appendPQExpBuffer(query, "with recursive w as "
"( " "( "
"select d1.objid, d2.refobjid, c2.relkind as refrelkind " "select d1.objid, d2.refobjid, c2.relkind as refrelkind "
...@@ -1808,7 +1812,6 @@ buildMatViewRefreshDependencies(Archive *fout) ...@@ -1808,7 +1812,6 @@ buildMatViewRefreshDependencies(Archive *fout)
"select 'pg_class'::regclass::oid as classid, objid, refobjid " "select 'pg_class'::regclass::oid as classid, objid, refobjid "
"from w " "from w "
"where refrelkind = 'm'"); "where refrelkind = 'm'");
}
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment