Skip to content

Commit 054df65

Browse files
author
Rucha Kulkarni
committed
Updated Babelfish code for community struct/function changes
Signed-off-by: Rucha Kulkarni <ruchask@amazon.com>
1 parent f7e82ee commit 054df65

2 files changed

Lines changed: 36 additions & 12 deletions

File tree

src/backend/commands/trigger.c

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6595,16 +6595,18 @@ InsteadofTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
65956595

65966596
if(event == TRIGGER_EVENT_DELETE)
65976597
{
6598-
old_tuplestore = transition_capture->tcs_private->old_del_tuplestore;
6598+
old_tuplestore = transition_capture->tcs_delete_private->old_tuplestore;
65996599
}
66006600
else if (event == TRIGGER_EVENT_UPDATE)
66016601
{
6602-
old_tuplestore = transition_capture->tcs_private->old_upd_tuplestore;
6602+
old_tuplestore = transition_capture->tcs_update_private->old_tuplestore;
66036603
}
66046604

66056605
if (map != NULL)
66066606
{
6607-
AfterTriggersTableData *table = transition_capture->tcs_private;
6607+
AfterTriggersTableData *table = (event == TRIGGER_EVENT_DELETE) ?
6608+
transition_capture->tcs_delete_private :
6609+
transition_capture->tcs_update_private;
66086610
TupleTableSlot *storeslot;
66096611

66106612
storeslot = GetAfterTriggersStoreSlot(table, map->outdesc);
@@ -6623,19 +6625,21 @@ InsteadofTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
66236625

66246626
if(event == TRIGGER_EVENT_INSERT)
66256627
{
6626-
new_tuplestore = transition_capture->tcs_private->new_ins_tuplestore;
6628+
new_tuplestore = transition_capture->tcs_insert_private->new_tuplestore;
66276629
}
66286630
else if (event == TRIGGER_EVENT_UPDATE)
66296631
{
6630-
new_tuplestore = transition_capture->tcs_private->new_upd_tuplestore;
6632+
new_tuplestore = transition_capture->tcs_update_private->new_tuplestore;
66316633
}
66326634

66336635
if (original_insert_tuple != NULL)
66346636
tuplestore_puttupleslot(new_tuplestore,
66356637
original_insert_tuple);
66366638
else if (map != NULL)
66376639
{
6638-
AfterTriggersTableData *table = transition_capture->tcs_private;
6640+
AfterTriggersTableData *table = (event == TRIGGER_EVENT_INSERT) ?
6641+
transition_capture->tcs_insert_private :
6642+
transition_capture->tcs_update_private;
66396643
TupleTableSlot *storeslot;
66406644

66416645
storeslot = GetAfterTriggersStoreSlot(table, map->outdesc);
@@ -6719,7 +6723,23 @@ InsteadofTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
67196723
new_shared.ats_firing_id = 0;
67206724
if ((trigger->tgoldtable || trigger->tgnewtable) &&
67216725
transition_capture != NULL)
6722-
new_shared.ats_table = transition_capture->tcs_private;
6726+
{
6727+
switch (event & TRIGGER_EVENT_OPMASK)
6728+
{
6729+
case TRIGGER_EVENT_INSERT:
6730+
new_shared.ats_table = transition_capture->tcs_insert_private;
6731+
break;
6732+
case TRIGGER_EVENT_UPDATE:
6733+
new_shared.ats_table = transition_capture->tcs_update_private;
6734+
break;
6735+
case TRIGGER_EVENT_DELETE:
6736+
new_shared.ats_table = transition_capture->tcs_delete_private;
6737+
break;
6738+
default:
6739+
new_shared.ats_table = NULL;
6740+
break;
6741+
}
6742+
}
67236743
else
67246744
new_shared.ats_table = NULL;
67256745
new_shared.ats_modifiedcols = modifiedCols;

src/backend/utils/cache/inval.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,13 @@ RegisterCatcacheInvalidation(int cacheId,
590590
static void
591591
RegisterENRCatcacheInvalidation(int cacheId,
592592
uint32 hashValue,
593-
Oid dbId)
593+
Oid dbId,
594+
void *context)
594595
{
596+
InvalidationInfo *info = (InvalidationInfo *) context;
597+
595598
SaveCatcacheMessage(cacheId, hashValue, dbId);
596-
AddCatcacheInvalidationMessage(&transInvalInfo->CurrentCmdInvalidMsgs,
599+
AddCatcacheInvalidationMessage(&info->CurrentCmdInvalidMsgs,
597600
cacheId, hashValue, dbId);
598601
}
599602

@@ -1562,11 +1565,12 @@ CacheInvalidateENRHeapTuple(Relation relation,
15621565
if (RelationInvalidatesSnapshotsOnly(tupleRelId))
15631566
{
15641567
databaseId = IsSharedRelation(tupleRelId) ? InvalidOid : MyDatabaseId;
1565-
RegisterSnapshotInvalidation(databaseId, tupleRelId);
1568+
RegisterSnapshotInvalidation((InvalidationInfo *) transInvalInfo, databaseId, tupleRelId);
15661569
}
15671570
else
15681571
PrepareToInvalidateCacheTuple(relation, tuple, newtuple,
1569-
RegisterENRCatcacheInvalidation);
1572+
RegisterENRCatcacheInvalidation,
1573+
(void *) transInvalInfo);
15701574

15711575
/*
15721576
* Now, is this tuple one of the primary definers of a relcache entry? See
@@ -1639,7 +1643,7 @@ CacheInvalidateENRHeapTuple(Relation relation,
16391643
/*
16401644
* Yes. We need to register a relcache invalidation event.
16411645
*/
1642-
RegisterRelcacheInvalidation(databaseId, relationId);
1646+
RegisterRelcacheInvalidation((InvalidationInfo *) transInvalInfo, databaseId, relationId);
16431647
}
16441648

16451649
/*

0 commit comments

Comments
 (0)