git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 639238b)
refactor: Pass relation OID instead of Relation to createForeignKeyCheckTriggers()
2025年3月25日 15:45:28 +0000 (16:45 +0100)
2025年3月25日 16:04:12 +0000 (17:04 +0100)
Currently, createForeignKeyCheckTriggers() takes a Relation type as
its first argument, but it doesn't use that argument directly.
Instead, it fetches the relation OID by calling RelationGetRelid().
Therefore, it would be more consistent with other functions (e.g.,
createForeignKeyCheckTriggers()) to pass the relation OID directly
instead of the whole Relation.

Author: Amul Sul <amul.sul@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b962c5AcYW9KUt_R_ER5qs3fUGbe4az-SP-vuwPS-w-AGA@mail.gmail.com


diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 2e51503da7fa0edaae868c8d55dd82f75003ca07..29ca7c9369cf4e8ac9b05046c3eb7a017603f6e0 100644 (file)
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -580,7 +580,7 @@ static void createForeignKeyCheckTriggers(Oid myRelOid, Oid refRelOid,
Oid indexOid,
Oid parentInsTrigger, Oid parentUpdTrigger,
Oid *insertTrigOid, Oid *updateTrigOid);
-static void createForeignKeyActionTriggers(Relation rel, Oid refRelOid,
+static void createForeignKeyActionTriggers(Oid myRelOid, Oid refRelOid,
Constraint *fkconstraint, Oid constraintOid,
Oid indexOid,
Oid parentDelTrigger, Oid parentUpdTrigger,
@@ -10688,7 +10688,8 @@ addFkRecurseReferenced(Constraint *fkconstraint, Relation rel,
/*
* Create the action triggers that enforce the constraint.
*/
- createForeignKeyActionTriggers(rel, RelationGetRelid(pkrel),
+ createForeignKeyActionTriggers(RelationGetRelid(rel),
+ RelationGetRelid(pkrel),
fkconstraint,
parentConstr, indexOid,
parentDelTrigger, parentUpdTrigger,
@@ -13216,7 +13217,7 @@ CreateFKCheckTrigger(Oid myRelOid, Oid refRelOid, Constraint *fkconstraint,
* *updateTrigOid.
*/
static void
-createForeignKeyActionTriggers(Relation rel, Oid refRelOid, Constraint *fkconstraint,
+createForeignKeyActionTriggers(Oid myRelOid, Oid refRelOid, Constraint *fkconstraint,
Oid constraintOid, Oid indexOid,
Oid parentDelTrigger, Oid parentUpdTrigger,
Oid *deleteTrigOid, Oid *updateTrigOid)
@@ -13275,8 +13276,7 @@ createForeignKeyActionTriggers(Relation rel, Oid refRelOid, Constraint *fkconstr
break;
}
- trigAddress = CreateTrigger(fk_trigger, NULL, refRelOid,
- RelationGetRelid(rel),
+ trigAddress = CreateTrigger(fk_trigger, NULL, refRelOid, myRelOid,
constraintOid, indexOid, InvalidOid,
parentDelTrigger, NULL, true, false);
if (deleteTrigOid)
@@ -13336,8 +13336,7 @@ createForeignKeyActionTriggers(Relation rel, Oid refRelOid, Constraint *fkconstr
break;
}
- trigAddress = CreateTrigger(fk_trigger, NULL, refRelOid,
- RelationGetRelid(rel),
+ trigAddress = CreateTrigger(fk_trigger, NULL, refRelOid, myRelOid,
constraintOid, indexOid, InvalidOid,
parentUpdTrigger, NULL, true, false);
if (updateTrigOid)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /