mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Cope with circularities involving a view's ON SELECT rule. I originally
thought there couldn't be any, but the folly of this was exposed by an example from andrew@supernews.com 5-Dec-2004. The patch applies the identical logic already used for table constraints and defaults to ON SELECT rules, so I have reasonable confidence in it even though it might look like complicated logic.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* by PostgreSQL
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.395 2004/12/14 21:35:20 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.396 2004/12/14 22:16:32 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -3160,12 +3160,21 @@ getRules(int *numRules)
|
||||
*/
|
||||
if (ruleinfo[i].ruletable->relkind == RELKIND_VIEW &&
|
||||
ruleinfo[i].ev_type == '1' && ruleinfo[i].is_instead)
|
||||
{
|
||||
addObjectDependency(&ruleinfo[i].ruletable->dobj,
|
||||
ruleinfo[i].dobj.dumpId);
|
||||
/* We'll merge the rule into CREATE VIEW, if possible */
|
||||
ruleinfo[i].separate = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
addObjectDependency(&ruleinfo[i].dobj,
|
||||
ruleinfo[i].ruletable->dobj.dumpId);
|
||||
ruleinfo[i].separate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
ruleinfo[i].separate = true;
|
||||
}
|
||||
|
||||
PQclear(res);
|
||||
@@ -7617,10 +7626,10 @@ dumpRule(Archive *fout, RuleInfo *rinfo)
|
||||
return;
|
||||
|
||||
/*
|
||||
* If it is an ON SELECT rule, we do not need to dump it because it
|
||||
* will be handled via CREATE VIEW for the table.
|
||||
* If it is an ON SELECT rule that is created implicitly by CREATE VIEW,
|
||||
* we do not want to dump it as a separate object.
|
||||
*/
|
||||
if (rinfo->ev_type == '1' && rinfo->is_instead)
|
||||
if (!rinfo->separate)
|
||||
return;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user