Commit f5297bdf authored by Tom Lane's avatar Tom Lane

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.
parent bb7520cc
......@@ -2010,7 +2010,7 @@
<entry>Foreign key match type:
<literal>f</> = full,
<literal>p</> = partial,
<literal>u</> = simple (unspecified)
<literal>s</> = simple
</entry>
</row>
......
......@@ -1160,7 +1160,7 @@ CREATE VIEW referential_constraints AS
CAST(
CASE con.confmatchtype WHEN 'f' THEN 'FULL'
WHEN 'p' THEN 'PARTIAL'
WHEN 'u' THEN 'NONE' END
WHEN 's' THEN 'NONE' END
AS character_data) AS match_option,
CAST(
......
......@@ -805,7 +805,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
char *constr_name;
char *fk_table_name;
char *pk_table_name;
char fk_matchtype = FKCONSTR_MATCH_UNSPECIFIED;
char fk_matchtype = FKCONSTR_MATCH_SIMPLE;
List *fk_attrs = NIL;
List *pk_attrs = NIL;
StringInfoData buf;
......@@ -831,7 +831,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
if (strcmp(strVal(arg), "FULL") == 0)
fk_matchtype = FKCONSTR_MATCH_FULL;
else
fk_matchtype = FKCONSTR_MATCH_UNSPECIFIED;
fk_matchtype = FKCONSTR_MATCH_SIMPLE;
continue;
}
if (i % 2)
......
......@@ -2972,11 +2972,11 @@ key_match: MATCH FULL
}
| MATCH SIMPLE
{
$$ = FKCONSTR_MATCH_UNSPECIFIED;
$$ = FKCONSTR_MATCH_SIMPLE;
}
| /*EMPTY*/
{
$$ = FKCONSTR_MATCH_UNSPECIFIED;
$$ = FKCONSTR_MATCH_SIMPLE;
}
;
......
This diff is collapsed.
......@@ -1184,7 +1184,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
case FKCONSTR_MATCH_PARTIAL:
string = " MATCH PARTIAL";
break;
case FKCONSTR_MATCH_UNSPECIFIED:
case FKCONSTR_MATCH_SIMPLE:
string = "";
break;
default:
......
......@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201206141
#define CATALOG_VERSION_NO 201206171
#endif
......@@ -1514,7 +1514,7 @@ typedef enum ConstrType /* types of constraints */
/* Foreign key matchtype codes */
#define FKCONSTR_MATCH_FULL 'f'
#define FKCONSTR_MATCH_PARTIAL 'p'
#define FKCONSTR_MATCH_UNSPECIFIED 'u'
#define FKCONSTR_MATCH_SIMPLE 's'
typedef struct Constraint
{
......@@ -1550,7 +1550,7 @@ typedef struct Constraint
RangeVar *pktable; /* Primary key table */
List *fk_attrs; /* Attributes of foreign key */
List *pk_attrs; /* Corresponding attrs in PK table */
char fk_matchtype; /* FULL, PARTIAL, UNSPECIFIED */
char fk_matchtype; /* FULL, PARTIAL, SIMPLE */
char fk_upd_action; /* ON UPDATE action */
char fk_del_action; /* ON DELETE action */
List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */
......
......@@ -339,7 +339,7 @@ SELECT * FROM PKTABLE;
DROP TABLE FKTABLE;
DROP TABLE PKTABLE;
-- MATCH unspecified
-- MATCH SIMPLE
-- Base test restricting update/delete
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
......
......@@ -214,7 +214,7 @@ DROP TABLE FKTABLE;
DROP TABLE PKTABLE;
-- MATCH unspecified
-- MATCH SIMPLE
-- Base test restricting update/delete
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment