Code quality improvement for
0294df2f1f84.
Aleksander Alekseev, reviewed by Richard Guo.
Discussion: https://postgr.es/m/CAJ7c6TMsiaV5urU_Pq6zJ2tXPDwk69-NKVh4AMN5XrRiM7N%2BGA%40mail.gmail.com
index fb768ad52c2a1c44bc83c950720c7457056c3f59..41da670f1506ecee67c1f80c6b1f9bba0bce195f 100644 (file)
{
RangeTblEntry *joinrte;
JoinExpr *joinexpr;
- bool have_action[3];
+ bool have_action[NUM_MERGE_MATCH_KINDS];
JoinType jointype;
int joinrti;
List *vars;
index bce11d59561debf5fa4c990d8c8e91a92275c0ca..87df79027d7fb3169d66f9f5966646342ddaa8d9 100644 (file)
@@ -109,7 +109,7 @@ transformMergeStmt(ParseState *pstate, MergeStmt *stmt)
Query *qry = makeNode(Query);
ListCell *l;
AclMode targetPerms = ACL_NO_RIGHTS;
- bool is_terminal[3];
+ bool is_terminal[NUM_MERGE_MATCH_KINDS];
Index sourceRTI;
List *mergeActionList;
ParseNamespaceItem *nsitem;
index fa2f70b7a4894104ba5ec7dfccf207a43147bc93..c1a65bad2a988363f7110712e7b52da94d26a2fc 100644 (file)
OnConflictSetState *ri_onConflict;
/* for MERGE, lists of MergeActionState (one per MergeMatchKind) */
- List *ri_MergeActions[3];
+ List *ri_MergeActions[NUM_MERGE_MATCH_KINDS];
/* for MERGE, expr state for checking the join condition */
ExprState *ri_MergeJoinCondition;
index 719c4b7b6156c2010f380f8a92b2237a92f2a735..247cecb4b4574244362c94d7da9400ac9ab935d5 100644 (file)
MERGE_WHEN_NOT_MATCHED_BY_TARGET
} MergeMatchKind;
+#define NUM_MERGE_MATCH_KINDS (MERGE_WHEN_NOT_MATCHED_BY_TARGET + 1)
+
typedef struct MergeAction
{
NodeTag type;