mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
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.
This commit is contained in:
@@ -207,12 +207,6 @@ ECPG: CopyStmtCOPYopt_binaryqualified_nameopt_column_listopt_oidscopy_fromcopy_f
|
||||
ECPG: CopyStmtCOPYselect_with_parensTOcopy_file_nameopt_withcopy_options addon
|
||||
if (strcmp($4, "stdin") == 0)
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN is not possible");
|
||||
ECPG: ConstraintAttributeSpecConstraintDeferrabilitySpecConstraintTimeSpec addon
|
||||
if (strcmp($1, "deferrable") != 0 && strcmp($2, "initially deferrable") == 0 )
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE");
|
||||
ECPG: ConstraintAttributeSpecConstraintTimeSpecConstraintDeferrabilitySpec addon
|
||||
if (strcmp($2, "deferrable") != 0 && strcmp($1, "initially deferrable") == 0 )
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE");
|
||||
ECPG: var_valueNumericOnly addon
|
||||
if ($1[0] == '$')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user