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

Commit0f3dd76

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 parent6fbbe33 commit0f3dd76

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

32083208
/*
32093209
* Get row security enabled information for the table. We represent
3210-
* RLS enabled on a table by creating PolicyInfo object with an empty
3211-
*policy.
3210+
* RLSbeingenabled on a table by creatingaPolicyInfo object with
3211+
*null polname.
32123212
*/
32133213
if (tbinfo->rowsec)
32143214
{
@@ -3349,8 +3349,13 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
33493349
query = createPQExpBuffer();
33503350

33513351
appendPQExpBuffer(query, "ALTER TABLE %s ENABLE ROW LEVEL SECURITY;",
3352-
fmtQualifiedDumpable(polinfo));
3352+
fmtQualifiedDumpable(tbinfo));
33533353

3354+
/*
3355+
* We must emit the ROW SECURITY object's dependency on its table
3356+
* explicitly, because it will not match anything in pg_depend (unlike
3357+
* the case for other PolicyInfo objects).
3358+
*/
33543359
if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY)
33553360
ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId,
33563361
polinfo->dobj.name,
@@ -3359,7 +3364,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
33593364
tbinfo->rolname, false,
33603365
"ROW SECURITY", SECTION_POST_DATA,
33613366
query->data, "", NULL,
3362-
NULL, 0,
3367+
&(tbinfo->dobj.dumpId), 1,
33633368
NULL, NULL);
33643369

33653370
destroyPQExpBuffer(query);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp