diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index d7928e999a2..77a6988d829 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -3049,8 +3049,8 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int numTables) /* * Get row security enabled information for the table. We represent - * RLS enabled on a table by creating PolicyInfo object with an empty - * policy. + * RLS being enabled on a table by creating a PolicyInfo object with + * null polname. */ if (tbinfo->rowsec) { @@ -3172,8 +3172,13 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo) query = createPQExpBuffer(); appendPQExpBuffer(query, "ALTER TABLE %s ENABLE ROW LEVEL SECURITY;", - fmtQualifiedDumpable(polinfo)); + fmtQualifiedDumpable(tbinfo)); + /* + * We must emit the ROW SECURITY object's dependency on its table + * explicitly, because it will not match anything in pg_depend (unlike + * the case for other PolicyInfo objects). + */ ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId, polinfo->dobj.name, polinfo->dobj.namespace->dobj.name, @@ -3181,7 +3186,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo) tbinfo->rolname, false, "ROW SECURITY", SECTION_POST_DATA, query->data, "", NULL, - NULL, 0, + &(tbinfo->dobj.dumpId), 1, NULL, NULL); destroyPQExpBuffer(query); |