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

Commitcbdca00

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 parent9b39b79 commitcbdca00

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
@@ -3480,8 +3480,8 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int numTables)
34803480

34813481
/*
34823482
* Get row security enabled information for the table. We represent
3483-
* RLS enabled on a table by creating PolicyInfo object with an empty
3484-
*policy.
3483+
* RLSbeingenabled on a table by creatingaPolicyInfo object with
3484+
*null polname.
34853485
*/
34863486
if (tbinfo->rowsec)
34873487
{
@@ -3622,8 +3622,13 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
36223622
query = createPQExpBuffer();
36233623

36243624
appendPQExpBuffer(query, "ALTER TABLE %s ENABLE ROW LEVEL SECURITY;",
3625-
fmtQualifiedDumpable(polinfo));
3625+
fmtQualifiedDumpable(tbinfo));
36263626

3627+
/*
3628+
* We must emit the ROW SECURITY object's dependency on its table
3629+
* explicitly, because it will not match anything in pg_depend (unlike
3630+
* the case for other PolicyInfo objects).
3631+
*/
36273632
if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY)
36283633
ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId,
36293634
polinfo->dobj.name,
@@ -3632,7 +3637,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
36323637
tbinfo->rolname, false,
36333638
"ROW SECURITY", SECTION_POST_DATA,
36343639
query->data, "", NULL,
3635-
NULL, 0,
3640+
&(tbinfo->dobj.dumpId), 1,
36363641
NULL, NULL);
36373642

36383643
destroyPQExpBuffer(query);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp