aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_dump_sort.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/pg_dump_sort.c')
-rw-r--r--src/bin/pg_dump/pg_dump_sort.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c
index cccc1e0646e..ddbe8305b13 100644
--- a/src/bin/pg_dump/pg_dump_sort.c
+++ b/src/bin/pg_dump/pg_dump_sort.c
@@ -725,12 +725,21 @@ static void
repairViewRuleMultiLoop(DumpableObject *viewobj,
DumpableObject *ruleobj)
{
+ TableInfo *viewinfo = (TableInfo *) viewobj;
+ RuleInfo *ruleinfo = (RuleInfo *) ruleobj;
+
/* remove view's dependency on rule */
removeObjectDependency(viewobj, ruleobj->dumpId);
/* pretend view is a plain table and dump it that way */
- ((TableInfo *) viewobj)->relkind = 'r'; /* RELKIND_RELATION */
+ viewinfo->relkind = 'r'; /* RELKIND_RELATION */
/* mark rule as needing its own dump */
- ((RuleInfo *) ruleobj)->separate = true;
+ ruleinfo->separate = true;
+ /* move any reloptions from view to rule */
+ if (viewinfo->reloptions)
+ {
+ ruleinfo->reloptions = viewinfo->reloptions;
+ viewinfo->reloptions = NULL;
+ }
/* put back rule's dependency on view */
addObjectDependency(ruleobj, viewobj->dumpId);
/* now that rule is separate, it must be post-data */