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

Commit173df4c

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 parent93ca07f commit173df4c

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

32303230
/*
32313231
* Get row security enabled information for the table. We represent
3232-
* RLS enabled on a table by creating PolicyInfo object with an empty
3233-
*policy.
3232+
* RLSbeingenabled on a table by creatingaPolicyInfo object with
3233+
*null polname.
32343234
*/
32353235
if (tbinfo->rowsec)
32363236
{
@@ -3353,8 +3353,13 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
33533353
query = createPQExpBuffer();
33543354

33553355
appendPQExpBuffer(query, "ALTER TABLE %s ENABLE ROW LEVEL SECURITY;",
3356-
fmtQualifiedDumpable(polinfo));
3356+
fmtQualifiedDumpable(tbinfo));
33573357

3358+
/*
3359+
* We must emit the ROW SECURITY object's dependency on its table
3360+
* explicitly, because it will not match anything in pg_depend (unlike
3361+
* the case for other PolicyInfo objects).
3362+
*/
33583363
if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY)
33593364
ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId,
33603365
polinfo->dobj.name,
@@ -3363,7 +3368,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
33633368
tbinfo->rolname, false,
33643369
"ROW SECURITY", SECTION_POST_DATA,
33653370
query->data, "", NULL,
3366-
NULL, 0,
3371+
&(tbinfo->dobj.dumpId), 1,
33673372
NULL, NULL);
33683373

33693374
destroyPQExpBuffer(query);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp