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

Commit299990b

Browse files
committed
Repair incorrect pg_dump labeling for some comments and security labels.
We attached no schema label to comments for procedural languages, casts,transforms, operator classes, operator families, or text search objects.The first three categories of objects don't really have schemas, butpg_dump treats them as if they do, and it seems like the TocEntry fieldsfor their comments had better match the TocEntry fields for the parentobjects. (As an example of a possible hazard, the type names in a CASTwill be formatted with the assumption of a particular search_path, sofailing to ensure that this same path is active for the COMMENT ON commandcould lead to an error or to attaching the comment to the wrong cast.)In the last six cases, this was a flat-out error --- possibly mine tobegin with, but it was a long time ago.The security label for a procedural language was likewise not correctlylabeled as to schema, and both the comment and security label for aprocedural language were not correctly labeled as to owner.In simple cases the restore would accidentally work correctly anyway, sincethese comments and security labels would normally get emitted right afterthe owning object, and so the search path and active user would be correctanyhow. But it could fail in corner cases; for example a schema-selectiverestore would omit comments it should include.Giuseppe Broccolo noted the oversight, and proposed the correct fix, fortext search dictionary objects; I found the rest by cross-checking otherdumpComment() calls. These oversights are ancient, so back-patch allthe way.Discussion:https://postgr.es/m/CAFzmHiWwwzLjzwM4x5ki5s_PDMR6NrkipZkjNnO3B0xEpBgJaA@mail.gmail.com
1 parentd4c62a6 commit299990b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10830,12 +10830,12 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang)
1083010830
/* Dump Proc Lang Comments and Security Labels */
1083110831
if (plang->dobj.dump & DUMP_COMPONENT_COMMENT)
1083210832
dumpComment(fout, labelq->data,
10833-
NULL, "",
10833+
lanschema, plang->lanowner,
1083410834
plang->dobj.catId, 0, plang->dobj.dumpId);
1083510835

1083610836
if (plang->dobj.dump & DUMP_COMPONENT_SECLABEL)
1083710837
dumpSecLabel(fout, labelq->data,
10838-
NULL, "",
10838+
lanschema, plang->lanowner,
1083910839
plang->dobj.catId, 0, plang->dobj.dumpId);
1084010840

1084110841
if (plang->lanpltrusted && plang->dobj.dump & DUMP_COMPONENT_ACL)
@@ -11585,7 +11585,7 @@ dumpCast(Archive *fout, CastInfo *cast)
1158511585
/* Dump Cast Comments */
1158611586
if (cast->dobj.dump & DUMP_COMPONENT_COMMENT)
1158711587
dumpComment(fout, labelq->data,
11588-
NULL, "",
11588+
"pg_catalog", "",
1158911589
cast->dobj.catId, 0, cast->dobj.dumpId);
1159011590

1159111591
free(sourceType);
@@ -11709,7 +11709,7 @@ dumpTransform(Archive *fout, TransformInfo *transform)
1170911709
/* Dump Transform Comments */
1171011710
if (transform->dobj.dump & DUMP_COMPONENT_COMMENT)
1171111711
dumpComment(fout, labelq->data,
11712-
NULL, "",
11712+
"pg_catalog", "",
1171311713
transform->dobj.catId, 0, transform->dobj.dumpId);
1171411714

1171511715
free(lanname);
@@ -12483,7 +12483,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
1248312483
/* Dump Operator Class Comments */
1248412484
if (opcinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
1248512485
dumpComment(fout, labelq->data,
12486-
NULL, opcinfo->rolname,
12486+
opcinfo->dobj.namespace->dobj.name, opcinfo->rolname,
1248712487
opcinfo->dobj.catId, 0, opcinfo->dobj.dumpId);
1248812488

1248912489
free(amname);
@@ -12756,7 +12756,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo)
1275612756
/* Dump Operator Family Comments */
1275712757
if (opfinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
1275812758
dumpComment(fout, labelq->data,
12759-
NULL, opfinfo->rolname,
12759+
opfinfo->dobj.namespace->dobj.name, opfinfo->rolname,
1276012760
opfinfo->dobj.catId, 0, opfinfo->dobj.dumpId);
1276112761

1276212762
free(amname);
@@ -13474,7 +13474,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo)
1347413474
/* Dump Parser Comments */
1347513475
if (prsinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
1347613476
dumpComment(fout, labelq->data,
13477-
NULL, "",
13477+
prsinfo->dobj.namespace->dobj.name, "",
1347813478
prsinfo->dobj.catId, 0, prsinfo->dobj.dumpId);
1347913479

1348013480
destroyPQExpBuffer(q);
@@ -13564,7 +13564,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo)
1356413564
/* Dump Dictionary Comments */
1356513565
if (dictinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
1356613566
dumpComment(fout, labelq->data,
13567-
NULL, dictinfo->rolname,
13567+
dictinfo->dobj.namespace->dobj.name, dictinfo->rolname,
1356813568
dictinfo->dobj.catId, 0, dictinfo->dobj.dumpId);
1356913569

1357013570
destroyPQExpBuffer(q);
@@ -13633,7 +13633,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo)
1363313633
/* Dump Template Comments */
1363413634
if (tmplinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
1363513635
dumpComment(fout, labelq->data,
13636-
NULL, "",
13636+
tmplinfo->dobj.namespace->dobj.name, "",
1363713637
tmplinfo->dobj.catId, 0, tmplinfo->dobj.dumpId);
1363813638

1363913639
destroyPQExpBuffer(q);
@@ -13764,7 +13764,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
1376413764
/* Dump Configuration Comments */
1376513765
if (cfginfo->dobj.dump & DUMP_COMPONENT_COMMENT)
1376613766
dumpComment(fout, labelq->data,
13767-
NULL, cfginfo->rolname,
13767+
cfginfo->dobj.namespace->dobj.name, cfginfo->rolname,
1376813768
cfginfo->dobj.catId, 0, cfginfo->dobj.dumpId);
1376913769

1377013770
destroyPQExpBuffer(q);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp