Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f5297bd

Browse files
committed
Refer to the default foreign key match style as MATCH SIMPLE internally.
Previously we followed the SQL92 wording, "MATCH <unspecified>", but since SQL99 there's been a less awkward way to refer to the default style. In addition to the code changes, pg_constraint.confmatchtype now stores this match style as 's' (SIMPLE) rather than 'u' (UNSPECIFIED). This doesn't affect pg_dump or psql because they use pg_get_constraintdef() to reconstruct foreign key definitions. But other client-side code might examine that column directly, so this change will have to be marked as an incompatibility in the 9.3 release notes.
1 parent bb7520c commit f5297bd

File tree

10 files changed

+134
-98
lines changed

10 files changed

+134
-98
lines changed

doc/src/sgml/catalogs.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,7 @@
20102010
<entry>Foreign key match type:
20112011
<literal>f</> = full,
20122012
<literal>p</> = partial,
2013-
<literal>u</> = simple (unspecified)
2013+
<literal>s</> = simple
20142014
</entry>
20152015
</row>
20162016

src/backend/catalog/information_schema.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ CREATE VIEW referential_constraints AS
11601160
CAST(
11611161
CASE con.confmatchtype WHEN 'f' THEN 'FULL'
11621162
WHEN 'p' THEN 'PARTIAL'
1163-
WHEN 'u' THEN 'NONE' END
1163+
WHEN 's' THEN 'NONE' END
11641164
AS character_data) AS match_option,
11651165

11661166
CAST(

src/backend/commands/trigger.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
805805
char *constr_name;
806806
char *fk_table_name;
807807
char *pk_table_name;
808-
char fk_matchtype = FKCONSTR_MATCH_UNSPECIFIED;
808+
char fk_matchtype = FKCONSTR_MATCH_SIMPLE;
809809
List *fk_attrs = NIL;
810810
List *pk_attrs = NIL;
811811
StringInfoData buf;
@@ -831,7 +831,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
831831
if (strcmp(strVal(arg), "FULL") == 0)
832832
fk_matchtype = FKCONSTR_MATCH_FULL;
833833
else
834-
fk_matchtype = FKCONSTR_MATCH_UNSPECIFIED;
834+
fk_matchtype = FKCONSTR_MATCH_SIMPLE;
835835
continue;
836836
}
837837
if (i % 2)

src/backend/parser/gram.y

+2-2
Original file line numberDiff line numberDiff line change
@@ -2972,11 +2972,11 @@ key_match: MATCH FULL
29722972
}
29732973
| MATCH SIMPLE
29742974
{
2975-
$$ = FKCONSTR_MATCH_UNSPECIFIED;
2975+
$$ = FKCONSTR_MATCH_SIMPLE;
29762976
}
29772977
| /*EMPTY*/
29782978
{
2979-
$$ = FKCONSTR_MATCH_UNSPECIFIED;
2979+
$$ = FKCONSTR_MATCH_SIMPLE;
29802980
}
29812981
;
29822982

0 commit comments

Comments
 (0)