mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Extend ALTER TABLE to allow Foreign Keys to be added without initial validation.
FK constraints that are marked NOT VALID may later be VALIDATED, which uses an ShareUpdateExclusiveLock on constraint table and RowShareLock on referenced table. Significantly reduces lock strength and duration when adding FKs. New state visible from psql. Simon Riggs, with reviews from Marko Tiikkaja and Robert Haas
This commit is contained in:
@@ -1140,6 +1140,7 @@ typedef enum AlterTableType
|
||||
AT_ReAddIndex, /* internal to commands/tablecmds.c */
|
||||
AT_AddConstraint, /* add constraint */
|
||||
AT_AddConstraintRecurse, /* internal to commands/tablecmds.c */
|
||||
AT_ValidateConstraint, /* validate constraint */
|
||||
AT_ProcessedConstraint, /* pre-processed add constraint (local in
|
||||
* parser/parse_utilcmd.c) */
|
||||
AT_AddIndexConstraint, /* add constraint using existing index */
|
||||
@@ -1182,6 +1183,7 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
|
||||
Node *transform; /* transformation expr for ALTER TYPE */
|
||||
DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */
|
||||
bool missing_ok; /* skip error if missing? */
|
||||
bool validated;
|
||||
} AlterTableCmd;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user