diff options
Diffstat (limited to 'src/backend/utils/adt/ri_triggers.c')
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 43228447ea4..65edc1fb04e 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -81,8 +81,8 @@ #define RI_PLAN_RESTRICT_UPD_CHECKREF 6 #define RI_PLAN_SETNULL_DEL_DOUPDATE 7 #define RI_PLAN_SETNULL_UPD_DOUPDATE 8 -#define RI_PLAN_SETDEFAULT_DEL_DOUPDATE 9 -#define RI_PLAN_SETDEFAULT_UPD_DOUPDATE 10 +#define RI_PLAN_SETDEFAULT_DEL_DOUPDATE 9 +#define RI_PLAN_SETDEFAULT_UPD_DOUPDATE 10 #define MAX_QUOTED_NAME_LEN (NAMEDATALEN*2+3) #define MAX_QUOTED_REL_NAME_LEN (MAX_QUOTED_NAME_LEN*2) @@ -135,7 +135,7 @@ typedef struct RI_ConstraintInfo typedef struct RI_QueryKey { Oid constr_id; /* OID of pg_constraint entry */ - int32 constr_queryno; /* query type ID, see RI_PLAN_XXX above */ + int32 constr_queryno; /* query type ID, see RI_PLAN_XXX above */ } RI_QueryKey; @@ -403,7 +403,7 @@ RI_FKey_check(TriggerData *trigdata) /* ---------- * The query string built is * SELECT 1 FROM ONLY <pktable> x WHERE pkatt1 = $1 [AND ...] - * FOR KEY SHARE OF x + * FOR KEY SHARE OF x * The type id's for the $ parameters are those of the * corresponding FK attributes. * ---------- @@ -539,7 +539,7 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel, /* ---------- * The query string built is * SELECT 1 FROM ONLY <pktable> x WHERE pkatt1 = $1 [AND ...] - * FOR KEY SHARE OF x + * FOR KEY SHARE OF x * The type id's for the $ parameters are those of the * PK attributes themselves. * ---------- @@ -697,8 +697,8 @@ ri_restrict_del(TriggerData *trigdata, bool is_no_action) } /* - * If another PK row now exists providing the old key values, - * we should not do anything. However, this check should only be + * If another PK row now exists providing the old key values, we + * should not do anything. However, this check should only be * made in the NO ACTION case; in RESTRICT cases we don't wish to * allow another row to be substituted. */ @@ -729,7 +729,7 @@ ri_restrict_del(TriggerData *trigdata, bool is_no_action) /* ---------- * The query string built is * SELECT 1 FROM ONLY <fktable> x WHERE $1 = fkatt1 [AND ...] - * FOR KEY SHARE OF x + * FOR KEY SHARE OF x * The type id's for the $ parameters are those of the * corresponding PK attributes. * ---------- @@ -921,8 +921,8 @@ ri_restrict_upd(TriggerData *trigdata, bool is_no_action) } /* - * If another PK row now exists providing the old key values, - * we should not do anything. However, this check should only be + * If another PK row now exists providing the old key values, we + * should not do anything. However, this check should only be * made in the NO ACTION case; in RESTRICT cases we don't wish to * allow another row to be substituted. */ @@ -1850,7 +1850,7 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS) * believe no check is necessary. So we need to do another lookup * now and in case a reference still exists, abort the operation. * That is already implemented in the NO ACTION trigger, so just - * run it. (This recheck is only needed in the SET DEFAULT case, + * run it. (This recheck is only needed in the SET DEFAULT case, * since CASCADE would remove such rows, while SET NULL is certain * to result in rows that satisfy the FK constraint.) */ @@ -2041,7 +2041,7 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS) * believe no check is necessary. So we need to do another lookup * now and in case a reference still exists, abort the operation. * That is already implemented in the NO ACTION trigger, so just - * run it. (This recheck is only needed in the SET DEFAULT case, + * run it. (This recheck is only needed in the SET DEFAULT case, * since CASCADE must change the FK key values, while SET NULL is * certain to result in rows that satisfy the FK constraint.) */ @@ -2150,6 +2150,7 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel, switch (riinfo->confmatchtype) { case FKCONSTR_MATCH_SIMPLE: + /* * If any new key value is NULL, the row must satisfy the * constraint, so no check is needed. @@ -2176,6 +2177,7 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel, return true; case FKCONSTR_MATCH_FULL: + /* * If all new key values are NULL, the row must satisfy the * constraint, so no check is needed. On the other hand, if only @@ -2449,7 +2451,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel) /* * The columns to look at in the result tuple are 1..N, not whatever - * they are in the fk_rel. Hack up riinfo so that the subroutines + * they are in the fk_rel. Hack up riinfo so that the subroutines * called here will behave properly. * * In addition to this, we have to pass the correct tupdesc to @@ -2676,8 +2678,8 @@ ri_BuildQueryKey(RI_QueryKey *key, const RI_ConstraintInfo *riinfo, int32 constr_queryno) { /* - * We assume struct RI_QueryKey contains no padding bytes, else we'd - * need to use memset to clear them. + * We assume struct RI_QueryKey contains no padding bytes, else we'd need + * to use memset to clear them. */ key->constr_id = riinfo->constraint_id; key->constr_queryno = constr_queryno; @@ -2812,14 +2814,14 @@ ri_LoadConstraintInfo(Oid constraintOid) elog(ERROR, "cache lookup failed for constraint %u", constraintOid); conForm = (Form_pg_constraint) GETSTRUCT(tup); - if (conForm->contype != CONSTRAINT_FOREIGN) /* should not happen */ + if (conForm->contype != CONSTRAINT_FOREIGN) /* should not happen */ elog(ERROR, "constraint %u is not a foreign key constraint", constraintOid); /* And extract data */ Assert(riinfo->constraint_id == constraintOid); riinfo->oidHashValue = GetSysCacheHashValue1(CONSTROID, - ObjectIdGetDatum(constraintOid)); + ObjectIdGetDatum(constraintOid)); memcpy(&riinfo->conname, &conForm->conname, sizeof(NameData)); riinfo->pk_relid = conForm->confrelid; riinfo->fk_relid = conForm->conrelid; @@ -3020,10 +3022,10 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo, /* * The values for the query are taken from the table on which the trigger - * is called - it is normally the other one with respect to query_rel. - * An exception is ri_Check_Pk_Match(), which uses the PK table for both - * (and sets queryno to RI_PLAN_CHECK_LOOKUPPK_FROM_PK). We might - * eventually need some less klugy way to determine this. + * is called - it is normally the other one with respect to query_rel. An + * exception is ri_Check_Pk_Match(), which uses the PK table for both (and + * sets queryno to RI_PLAN_CHECK_LOOKUPPK_FROM_PK). We might eventually + * need some less klugy way to determine this. */ if (qkey->constr_queryno == RI_PLAN_CHECK_LOOKUPPK) { |