Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5e235f

Browse files
committed
Fix missing dependency for pg_dump's ENABLE ROW LEVEL SECURITY items.
The archive should show a dependency on the item's table, but it failedto include one. This could cause failures in parallel restore due toemitting ALTER TABLE ... ENABLE ROW LEVEL SECURITY before restoringthe table's data. In practice the odds of a problem seem low, sinceyou would typically need to have set FORCE ROW LEVEL SECURITY as well,and you'd also need a very high --jobs count to have any chance of thishappening. That probably explains the lack of field reports.Still, it's a bug, so back-patch to 9.5 where RLS was introduced.Discussion:https://postgr.es/m/19784.1535390902@sss.pgh.pa.us
1 parent9ca2207 commitc5e235f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3471,8 +3471,8 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int numTables)
34713471

34723472
/*
34733473
* Get row security enabled information for the table. We represent
3474-
* RLS enabled on a table by creating PolicyInfo object with an empty
3475-
*policy.
3474+
* RLSbeingenabled on a table by creatingaPolicyInfo object with
3475+
*null polname.
34763476
*/
34773477
if (tbinfo->rowsec)
34783478
{
@@ -3613,8 +3613,13 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
36133613
query = createPQExpBuffer();
36143614

36153615
appendPQExpBuffer(query, "ALTER TABLE %s ENABLE ROW LEVEL SECURITY;",
3616-
fmtQualifiedDumpable(polinfo));
3616+
fmtQualifiedDumpable(tbinfo));
36173617

3618+
/*
3619+
* We must emit the ROW SECURITY object's dependency on its table
3620+
* explicitly, because it will not match anything in pg_depend (unlike
3621+
* the case for other PolicyInfo objects).
3622+
*/
36183623
if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY)
36193624
ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId,
36203625
polinfo->dobj.name,
@@ -3623,7 +3628,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
36233628
tbinfo->rolname, false,
36243629
"ROW SECURITY", SECTION_POST_DATA,
36253630
query->data, "", NULL,
3626-
NULL, 0,
3631+
&(tbinfo->dobj.dumpId), 1,
36273632
NULL, NULL);
36283633

36293634
destroyPQExpBuffer(query);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp