Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ec497a5a
Commit
ec497a5a
authored
Mar 22, 2011
by
Simon Riggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make FKs valid at creation when added as column constraints.
Bug report from Alvaro Herrera
parent
5d1d679d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
1 deletion
+9
-1
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+1
-1
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+1
-0
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+1
-0
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+1
-0
src/backend/parser/gram.y
src/backend/parser/gram.y
+3
-0
src/backend/parser/parse_utilcmd.c
src/backend/parser/parse_utilcmd.c
+1
-0
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+1
-0
No files found.
src/backend/commands/tablecmds.c
View file @
ec497a5a
...
...
@@ -5595,7 +5595,7 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
CONSTRAINT_FOREIGN
,
fkconstraint
->
deferrable
,
fkconstraint
->
initdeferred
,
!
fkconstraint
->
skip_validation
,
fkconstraint
->
initially_valid
,
RelationGetRelid
(
rel
),
fkattnum
,
numfks
,
...
...
src/backend/nodes/copyfuncs.c
View file @
ec497a5a
...
...
@@ -2341,6 +2341,7 @@ _copyConstraint(Constraint *from)
COPY_SCALAR_FIELD
(
fk_upd_action
);
COPY_SCALAR_FIELD
(
fk_del_action
);
COPY_SCALAR_FIELD
(
skip_validation
);
COPY_SCALAR_FIELD
(
initially_valid
);
return
newnode
;
}
...
...
src/backend/nodes/equalfuncs.c
View file @
ec497a5a
...
...
@@ -2270,6 +2270,7 @@ _equalConstraint(Constraint *a, Constraint *b)
COMPARE_SCALAR_FIELD
(
fk_upd_action
);
COMPARE_SCALAR_FIELD
(
fk_del_action
);
COMPARE_SCALAR_FIELD
(
skip_validation
);
COMPARE_SCALAR_FIELD
(
initially_valid
);
return
true
;
}
...
...
src/backend/nodes/outfuncs.c
View file @
ec497a5a
...
...
@@ -2625,6 +2625,7 @@ _outConstraint(StringInfo str, Constraint *node)
WRITE_CHAR_FIELD
(
fk_upd_action
);
WRITE_CHAR_FIELD
(
fk_del_action
);
WRITE_BOOL_FIELD
(
skip_validation
);
WRITE_BOOL_FIELD
(
initially_valid
);
break
;
case
CONSTR_ATTR_DEFERRABLE
:
...
...
src/backend/parser/gram.y
View file @
ec497a5a
...
...
@@ -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;
}
;
...
...
src/backend/parser/parse_utilcmd.c
View file @
ec497a5a
...
...
@@ -1696,6 +1696,7 @@ transformFKConstraints(CreateStmtContext *cxt,
Constraint
*
constraint
=
(
Constraint
*
)
lfirst
(
fkclist
);
constraint
->
skip_validation
=
true
;
constraint
->
initially_valid
=
true
;
}
}
...
...
src/include/nodes/parsenodes.h
View file @
ec497a5a
...
...
@@ -1536,6 +1536,7 @@ typedef struct Constraint
char
fk_upd_action
;
/* ON UPDATE action */
char
fk_del_action
;
/* ON DELETE action */
bool
skip_validation
;
/* skip validation of existing rows? */
bool
initially_valid
;
/* start the new constraint as valid */
}
Constraint
;
/* ----------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment