* No check - if NULLs are allowed at all is already checked by
* NOT NULL constraint.
*
- * This is true for MATCH FULL, MATCH PARTIAL, and MATCH
- * <unspecified>
+ * This is true for MATCH FULL, MATCH PARTIAL, and MATCH SIMPLE.
*/
heap_close(pk_rel, RowShareLock);
return PointerGetDatum(NULL);
heap_close(pk_rel, RowShareLock);
return PointerGetDatum(NULL);
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
/*
- * MATCH <unspecified> - if ANY column is null, we have a
- * match.
+ * MATCH SIMPLE - if ANY column is null, we have a match.
*/
heap_close(pk_rel, RowShareLock);
return PointerGetDatum(NULL);
errmsg("MATCH PARTIAL not yet implemented")));
heap_close(pk_rel, RowShareLock);
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
case RI_KEYS_NONE_NULL:
switch (riinfo->confmatchtype)
{
case FKCONSTR_MATCH_FULL:
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
/*
- * MATCH <unspecified>/FULL - if ANY column is null, we
+ * MATCH SIMPLE/FULL - if ANY column is null, we
* can't be matching to this row already.
*/
return true;
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
break;
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo->confmatchtype);
+ break;
}
case RI_KEYS_NONE_NULL:
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 6) a) iv):
- * MATCH <unspecified> or MATCH FULL
+ * General rules 6) a) iv):
+ * MATCH SIMPLE/FULL
* ... ON DELETE CASCADE
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_NOACTION_DEL_CHECKREF);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 6) a) iv):
- * MATCH <unspecified> or MATCH FULL
+ * General rules 6) a) iv):
+ * MATCH SIMPLE/FULL
* ... ON DELETE CASCADE
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_NOACTION_UPD_CHECKREF);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 6) a) i):
- * MATCH <unspecified> or MATCH FULL
+ * General rules 6) a) i):
+ * MATCH SIMPLE/FULL
* ... ON DELETE CASCADE
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_CASCADE_DEL_DODELETE);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 7) a) i):
- * MATCH <unspecified> or MATCH FULL
+ * General rules 7) a) i):
+ * MATCH SIMPLE/FULL
* ... ON UPDATE CASCADE
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_CASCADE_UPD_DOUPDATE);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 6) a) iv):
- * MATCH <unspecified> or MATCH FULL
+ * General rules 6) a) iv):
+ * MATCH SIMPLE/FULL
* ... ON DELETE CASCADE
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_RESTRICT_DEL_CHECKREF);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 6) a) iv):
- * MATCH <unspecified> or MATCH FULL
+ * General rules 6) a) iv):
+ * MATCH SIMPLE/FULL
* ... ON DELETE CASCADE
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_RESTRICT_UPD_CHECKREF);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 6) a) ii):
- * MATCH <UNSPECIFIED> or MATCH FULL
+ * General rules 6) a) ii):
+ * MATCH SIMPLE/FULL
* ... ON DELETE SET NULL
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_SETNULL_DEL_DOUPDATE);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 7) a) ii) 2):
+ * General rules 7) a) ii) 2):
* MATCH FULL
* ... ON UPDATE SET NULL
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_SETNULL_UPD_DOUPDATE);
elog(ERROR, "SPI_connect failed");
/*
- * "MATCH <unspecified>" only changes columns corresponding to the
+ * "MATCH SIMPLE" only changes columns corresponding to the
* referenced columns that have changed in pk_rel. This means the
* "SET attrn=NULL [, attrn=NULL]" string will be change as well.
* In this case, we need to build a temporary plan rather than use
RIAttName(fk_rel, riinfo.fk_attnums[i]));
/*
- * MATCH <unspecified> - only change columns corresponding
+ * MATCH SIMPLE - only change columns corresponding
* to changed columns in pk_rel's key
*/
if (riinfo.confmatchtype == FKCONSTR_MATCH_FULL ||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 6) a) iii):
- * MATCH <UNSPECIFIED> or MATCH FULL
+ * General rules 6) a) iii):
+ * MATCH SIMPLE/FULL
* ... ON DELETE SET DEFAULT
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_SETNULL_DEL_DOUPDATE);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
{
/* ----------
* SQL3 11.9 <referential constraint definition>
- * Gereral rules 7) a) iii):
- * MATCH <UNSPECIFIED> or MATCH FULL
+ * General rules 7) a) iii):
+ * MATCH SIMPLE/FULL
* ... ON UPDATE SET DEFAULT
* ----------
*/
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
ri_BuildQueryKeyFull(&qkey, &riinfo,
RI_PLAN_SETNULL_DEL_DOUPDATE);
RIAttName(fk_rel, riinfo.fk_attnums[i]));
/*
- * MATCH <unspecified> - only change columns corresponding
+ * MATCH SIMPLE - only change columns corresponding
* to changed columns in pk_rel's key
*/
if (riinfo.confmatchtype == FKCONSTR_MATCH_FULL ||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
return PointerGetDatum(NULL);
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
- /*
- * Never reached
- */
- elog(ERROR, "invalid confmatchtype");
+ /* Never reached */
return PointerGetDatum(NULL);
}
switch (riinfo.confmatchtype)
{
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
/* Return true if keys are equal */
return ri_KeysEqual(pk_rel, old_row, new_row, &riinfo, true);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
break;
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
/* Never reached */
- elog(ERROR, "invalid confmatchtype");
return false;
}
switch (riinfo.confmatchtype)
{
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
case FKCONSTR_MATCH_FULL:
/* Return true if keys are equal */
return ri_KeysEqual(fk_rel, old_row, new_row, &riinfo, false);
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("MATCH PARTIAL not yet implemented")));
break;
+
+ default:
+ elog(ERROR, "unrecognized confmatchtype: %d",
+ riinfo.confmatchtype);
+ break;
}
/* Never reached */
- elog(ERROR, "invalid confmatchtype");
return false;
}
* LEFT OUTER JOIN ONLY pkrelname pk
* ON (pk.pkkeycol1=fk.keycol1 [AND ...])
* WHERE pk.pkkeycol1 IS NULL AND
- * For MATCH unspecified:
+ * For MATCH SIMPLE:
* (fk.keycol1 IS NOT NULL [AND ...])
* For MATCH FULL:
* (fk.keycol1 IS NOT NULL [OR ...])
sep, fkattname);
switch (riinfo.confmatchtype)
{
- case FKCONSTR_MATCH_UNSPECIFIED:
+ case FKCONSTR_MATCH_SIMPLE:
sep = " AND ";
break;
case FKCONSTR_MATCH_FULL:
errmsg("MATCH PARTIAL not yet implemented")));
break;
default:
- elog(ERROR, "unrecognized match type: %d",
+ elog(ERROR, "unrecognized confmatchtype: %d",
riinfo.confmatchtype);
break;
}