pg_dump: fix failure to dump comments on constraints in some cases.
Thinko in commit 5209c0ba0: 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
This commit is contained in:
parent
d54e79ba28
commit
26ee7fb368
@ -10996,7 +10996,7 @@ dumpDomain(Archive *fout, const TypeInfo *tyinfo)
|
||||
appendPQExpBuffer(conprefix, "CONSTRAINT %s ON DOMAIN",
|
||||
fmtId(domcheck->dobj.name));
|
||||
|
||||
if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
|
||||
if (domcheck->dobj.dump & DUMP_COMPONENT_COMMENT)
|
||||
dumpComment(fout, conprefix->data, qtypname,
|
||||
tyinfo->dobj.namespace->dobj.name,
|
||||
tyinfo->rolname,
|
||||
@ -15868,7 +15868,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
|
||||
if (constr->separate || !constr->conislocal)
|
||||
continue;
|
||||
|
||||
if (tbinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
|
||||
if (constr->dobj.dump & DUMP_COMPONENT_COMMENT)
|
||||
dumpTableConstraintComment(fout, constr);
|
||||
}
|
||||
|
||||
|
@ -1690,13 +1690,16 @@ my %tests = (
|
||||
COLLATE "C"
|
||||
DEFAULT \'10014\'
|
||||
CHECK(VALUE ~ \'^\d{5}$\' OR
|
||||
VALUE ~ \'^\d{5}-\d{4}$\');',
|
||||
VALUE ~ \'^\d{5}-\d{4}$\');
|
||||
COMMENT ON CONSTRAINT us_postal_code_check
|
||||
ON DOMAIN dump_test.us_postal_code IS \'check it\';',
|
||||
regexp => qr/^
|
||||
\QCREATE DOMAIN dump_test.us_postal_code AS text COLLATE pg_catalog."C" DEFAULT '10014'::text\E\n\s+
|
||||
\QCONSTRAINT us_postal_code_check CHECK \E
|
||||
\Q(((VALUE ~ '^\d{5}\E
|
||||
\$\Q'::text) OR (VALUE ~ '^\d{5}-\d{4}\E\$
|
||||
\Q'::text)));\E
|
||||
\Q'::text)));\E(.|\n)*
|
||||
\QCOMMENT ON CONSTRAINT us_postal_code_check ON DOMAIN dump_test.us_postal_code IS 'check it';\E
|
||||
/xm,
|
||||
like =>
|
||||
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
|
||||
@ -2639,7 +2642,9 @@ my %tests = (
|
||||
col3 text,
|
||||
col4 text,
|
||||
CHECK (col1 <= 1000)
|
||||
) WITH (autovacuum_enabled = false, fillfactor=80);',
|
||||
) WITH (autovacuum_enabled = false, fillfactor=80);
|
||||
COMMENT ON CONSTRAINT test_table_col1_check
|
||||
ON dump_test.test_table IS \'bounds check\';',
|
||||
regexp => qr/^
|
||||
\QCREATE TABLE dump_test.test_table (\E\n
|
||||
\s+\Qcol1 integer NOT NULL,\E\n
|
||||
@ -2648,7 +2653,9 @@ my %tests = (
|
||||
\s+\Qcol4 text,\E\n
|
||||
\s+\QCONSTRAINT test_table_col1_check CHECK ((col1 <= 1000))\E\n
|
||||
\Q)\E\n
|
||||
\QWITH (autovacuum_enabled='false', fillfactor='80');\E\n/xm,
|
||||
\QWITH (autovacuum_enabled='false', fillfactor='80');\E\n(.|\n)*
|
||||
\QCOMMENT ON CONSTRAINT test_table_col1_check ON dump_test.test_table IS 'bounds check';\E
|
||||
/xm,
|
||||
like => {
|
||||
%full_runs,
|
||||
%dump_test_schema_runs,
|
||||
|
Loading…
x
Reference in New Issue
Block a user