From e1ccaff6eea1b48f4b9b28cabaf0f990119b0d19 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 15 Jun 2011 19:05:11 -0400 Subject: Rework parsing of ConstraintAttributeSpec to improve NOT VALID handling. The initial commit of the ALTER TABLE ADD FOREIGN KEY NOT VALID feature failed to support labeling such constraints as deferrable. The best fix for this seems to be to fold NOT VALID into ConstraintAttributeSpec. That's a bit more general than the documented syntax, but it allows better-targeted syntax error messages. In addition, do some mostly-but-not-entirely-cosmetic code review for the whole NOT VALID patch. --- src/backend/parser/parse_utilcmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/backend/parser/parse_utilcmd.c') diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 485bf4b8e7f..51899c6b5b4 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -1751,7 +1751,8 @@ transformFKConstraints(CreateStmtContext *cxt, /* * If CREATE TABLE or adding a column with NULL default, we can safely - * skip validation of the constraint. + * skip validation of FK constraints, and nonetheless mark them valid. + * (This will override any user-supplied NOT VALID flag.) */ if (skipValidation) { -- cgit v1.2.3