From bd16ef0ead6914985eb377aeb5d19c7084799ad0 Mon Sep 17 00:00:00 2001 From: Michael P Date: Thu, 5 Apr 2012 16:18:59 +0900 Subject: Fix for bug 3485997: UPDATE fails on table with foreign key This commit provides a fix for Coordinator trying to fetch a tuple locally. This is not possible as all the data is localized on Datanodes. This commit also enables reference integrity check on Datanodes. This is thought as safe as XC has already some check mechanisms at constraint creation to insure that constraint can be checked locally based on its dependant table distributions. Patch by Andrei Martsinchyk, I just fixed a bug with reference integrity attempt check on Coordinator. --- src/backend/executor/nodeModifyTable.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/backend/executor/nodeModifyTable.c') diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 9889f3470a..0cf693aec4 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -437,6 +437,12 @@ ldelete:; if (canSetTag) (estate->es_processed)++; +#ifdef PGXC + /* + * Do not fire triggers on remote relation, it would not find old tuple + */ + if (resultRemoteRel == NULL) +#endif /* AFTER ROW DELETE Triggers */ ExecARDeleteTriggers(estate, resultRelInfo, tupleid); @@ -683,6 +689,12 @@ lreplace:; if (canSetTag) (estate->es_processed)++; +#ifdef PGXC + /* + * Do not fire triggers on remote relation, it would not find old tuple + */ + if (resultRemoteRel == NULL) +#endif /* AFTER ROW UPDATE Triggers */ ExecARUpdateTriggers(estate, resultRelInfo, tupleid, tuple, recheckIndexes); -- cgit v1.2.3