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

Commitc3be085

Browse files
committed
Modify pg_dump to assume that a check constraint is inherited if its
name matches the name of any parent-table constraint, without lookingat the constraint text. This is a not-very-bulletproof workaround forthe problem exhibited by Berend Tober last month. We really ought torecord constraint inheritance status in pg_constraint, but it's lookinglike that may not get done for 8.1 --- and even if it does, we willneed this kluge for dumping from older servers.
1 parentfc72240 commitc3be085

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.85 2004/12/31 22:03:07 pgsql Exp $
14+
* $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.86 2005/06/27 02:17:47 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -347,8 +347,14 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
347347

348348
/*
349349
* Check for inherited CHECK constraints. We assume a constraint
350-
* is inherited if its expression matches the parent and the name
351-
* is the same, *or* both names start with '$'.
350+
* is inherited if its name matches the name of any constraint in
351+
* the parent. Originally this code tried to compare the expression
352+
* texts, but that can fail if the parent and child tables are in
353+
* different schemas, because reverse-listing of function calls may
354+
* produce different text (schema-qualified or not) depending on
355+
* search path. We really need a more bulletproof way of detecting
356+
* inherited constraints --- pg_constraint should record this
357+
* explicitly!
352358
*/
353359
for (j=0;j<tbinfo->ncheck;j++)
354360
{
@@ -363,14 +369,9 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
363369
parent=parents[k];
364370
for (l=0;l<parent->ncheck;l++)
365371
{
366-
ConstraintInfo*pconstr;
367-
368-
pconstr=&(parent->checkexprs[l]);
369-
if (strcmp(pconstr->condef,constr->condef)!=0)
370-
continue;
371-
if (strcmp(pconstr->dobj.name,constr->dobj.name)==0||
372-
(pconstr->dobj.name[0]=='$'&&
373-
constr->dobj.name[0]=='$'))
372+
ConstraintInfo*pconstr=&(parent->checkexprs[l]);
373+
374+
if (strcmp(pconstr->dobj.name,constr->dobj.name)==0)
374375
{
375376
constr->coninherited= true;
376377
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp