1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +03:00

Make FKs valid at creation when added as column constraints.

Bug report from Alvaro Herrera
This commit is contained in:
Simon Riggs
2011-03-22 23:10:35 +00:00
parent 5d1d679dbf
commit ec497a5ad6
7 changed files with 9 additions and 1 deletions

View File

@@ -2621,6 +2621,7 @@ ColConstraintElem:
n->fk_upd_action = (char) ($5 >> 8);
n->fk_del_action = (char) ($5 & 0xFF);
n->skip_validation = FALSE;
n->initially_valid = true;
$$ = (Node *)n;
}
;
@@ -2820,6 +2821,7 @@ ConstraintElem:
n->deferrable = ($11 & 1) != 0;
n->initdeferred = ($11 & 2) != 0;
n->skip_validation = false;
n->initially_valid = true;
$$ = (Node *)n;
}
| FOREIGN KEY '(' columnList ')' REFERENCES qualified_name
@@ -2836,6 +2838,7 @@ ConstraintElem:
n->fk_upd_action = (char) ($10 >> 8);
n->fk_del_action = (char) ($10 & 0xFF);
n->skip_validation = true;
n->initially_valid = false;
$$ = (Node *)n;
}
;

View File

@@ -1696,6 +1696,7 @@ transformFKConstraints(CreateStmtContext *cxt,
Constraint *constraint = (Constraint *) lfirst(fkclist);
constraint->skip_validation = true;
constraint->initially_valid = true;
}
}