MergeAction can have 3 merge kinds (now enum) in PG17, write compat

Relevant PG commit:
0294df2f1f842dfb0eed79007b21016f486a3c6c
0294df2f1f
pg17_kickoff
naisila 2024-07-10 14:23:17 +02:00
parent e0a0874fbd
commit 49f7bffcf6
No known key found for this signature in database
GPG Key ID: A824BA9862D73E6D
2 changed files with 6 additions and 1 deletions

View File

@ -1475,7 +1475,7 @@ FetchAndValidateInsertVarIfExists(Oid targetRelationId, Query *query)
foreach_declared_ptr(action, query->mergeActionList) foreach_declared_ptr(action, query->mergeActionList)
{ {
/* Skip MATCHED clause as INSERTS are not allowed in it */ /* Skip MATCHED clause as INSERTS are not allowed in it */
if (action->matched) if (matched_compat(action))
{ {
continue; continue;
} }

View File

@ -101,6 +101,9 @@ getStxstattarget_compat(HeapTuple tup)
#define WaitEventSetTracker_compat CurrentResourceOwner #define WaitEventSetTracker_compat CurrentResourceOwner
#define identitySequenceRelation_compat(a) (a) #define identitySequenceRelation_compat(a) (a)
#define matched_compat(a) (a->matchKind == MERGE_WHEN_MATCHED)
#else #else
#include "access/htup_details.h" #include "access/htup_details.h"
@ -126,6 +129,8 @@ getStxstattarget_compat(HeapTuple tup)
#define identitySequenceRelation_compat(a) (RelationGetRelid(a)) #define identitySequenceRelation_compat(a) (RelationGetRelid(a))
#define matched_compat(a) (a->matched)
#endif #endif
#if PG_VERSION_NUM >= PG_VERSION_16 #if PG_VERSION_NUM >= PG_VERSION_16