Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 26ee7fb

Browse files
committed
pg_dump: fix failure to dump comments on constraints in some cases.
Thinko in commit 5209c0b: I checked the wrong object's DUMP_COMPONENT_COMMENT bit in two places. Per bug #17675 from Franz-Josef Färber. Discussion: https://postgr.es/m/17675-c69c001e06390867@postgresql.org
1 parent d54e79b commit 26ee7fb

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/bin/pg_dump/pg_dump.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -10996,7 +10996,7 @@ dumpDomain(Archive *fout, const TypeInfo *tyinfo)
1099610996
appendPQExpBuffer(conprefix, "CONSTRAINT %s ON DOMAIN",
1099710997
fmtId(domcheck->dobj.name));
1099810998

10999-
if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
10999+
if (domcheck->dobj.dump & DUMP_COMPONENT_COMMENT)
1100011000
dumpComment(fout, conprefix->data, qtypname,
1100111001
tyinfo->dobj.namespace->dobj.name,
1100211002
tyinfo->rolname,
@@ -15868,7 +15868,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
1586815868
if (constr->separate || !constr->conislocal)
1586915869
continue;
1587015870

15871-
if (tbinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
15871+
if (constr->dobj.dump & DUMP_COMPONENT_COMMENT)
1587215872
dumpTableConstraintComment(fout, constr);
1587315873
}
1587415874

src/bin/pg_dump/t/002_pg_dump.pl

+11-4
Original file line numberDiff line numberDiff line change
@@ -1690,13 +1690,16 @@
16901690
COLLATE "C"
16911691
DEFAULT \'10014\'
16921692
CHECK(VALUE ~ \'^\d{5}$\' OR
1693-
VALUE ~ \'^\d{5}-\d{4}$\');',
1693+
VALUE ~ \'^\d{5}-\d{4}$\');
1694+
COMMENT ON CONSTRAINT us_postal_code_check
1695+
ON DOMAIN dump_test.us_postal_code IS \'check it\';',
16941696
regexp => qr/^
16951697
\QCREATE DOMAIN dump_test.us_postal_code AS text COLLATE pg_catalog."C" DEFAULT '10014'::text\E\n\s+
16961698
\QCONSTRAINT us_postal_code_check CHECK \E
16971699
\Q(((VALUE ~ '^\d{5}\E
16981700
\$\Q'::text) OR (VALUE ~ '^\d{5}-\d{4}\E\$
1699-
\Q'::text)));\E
1701+
\Q'::text)));\E(.|\n)*
1702+
\QCOMMENT ON CONSTRAINT us_postal_code_check ON DOMAIN dump_test.us_postal_code IS 'check it';\E
17001703
/xm,
17011704
like =>
17021705
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
@@ -2639,7 +2642,9 @@
26392642
col3 text,
26402643
col4 text,
26412644
CHECK (col1 <= 1000)
2642-
) WITH (autovacuum_enabled = false, fillfactor=80);',
2645+
) WITH (autovacuum_enabled = false, fillfactor=80);
2646+
COMMENT ON CONSTRAINT test_table_col1_check
2647+
ON dump_test.test_table IS \'bounds check\';',
26432648
regexp => qr/^
26442649
\QCREATE TABLE dump_test.test_table (\E\n
26452650
\s+\Qcol1 integer NOT NULL,\E\n
@@ -2648,7 +2653,9 @@
26482653
\s+\Qcol4 text,\E\n
26492654
\s+\QCONSTRAINT test_table_col1_check CHECK ((col1 <= 1000))\E\n
26502655
\Q)\E\n
2651-
\QWITH (autovacuum_enabled='false', fillfactor='80');\E\n/xm,
2656+
\QWITH (autovacuum_enabled='false', fillfactor='80');\E\n(.|\n)*
2657+
\QCOMMENT ON CONSTRAINT test_table_col1_check ON dump_test.test_table IS 'bounds check';\E
2658+
/xm,
26522659
like => {
26532660
%full_runs,
26542661
%dump_test_schema_runs,

0 commit comments

Comments
 (0)