mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Use macro NUM_MERGE_MATCH_KINDS instead of '3' in MERGE code.
Code quality improvement for 0294df2f1f84. Aleksander Alekseev, reviewed by Richard Guo. Discussion: https://postgr.es/m/CAJ7c6TMsiaV5urU_Pq6zJ2tXPDwk69-NKVh4AMN5XrRiM7N%2BGA%40mail.gmail.com
This commit is contained in:
parent
f6e8451336
commit
2e068db56e
@ -153,7 +153,7 @@ transform_MERGE_to_join(Query *parse)
|
|||||||
{
|
{
|
||||||
RangeTblEntry *joinrte;
|
RangeTblEntry *joinrte;
|
||||||
JoinExpr *joinexpr;
|
JoinExpr *joinexpr;
|
||||||
bool have_action[3];
|
bool have_action[NUM_MERGE_MATCH_KINDS];
|
||||||
JoinType jointype;
|
JoinType jointype;
|
||||||
int joinrti;
|
int joinrti;
|
||||||
List *vars;
|
List *vars;
|
||||||
|
@ -109,7 +109,7 @@ transformMergeStmt(ParseState *pstate, MergeStmt *stmt)
|
|||||||
Query *qry = makeNode(Query);
|
Query *qry = makeNode(Query);
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
AclMode targetPerms = ACL_NO_RIGHTS;
|
AclMode targetPerms = ACL_NO_RIGHTS;
|
||||||
bool is_terminal[3];
|
bool is_terminal[NUM_MERGE_MATCH_KINDS];
|
||||||
Index sourceRTI;
|
Index sourceRTI;
|
||||||
List *mergeActionList;
|
List *mergeActionList;
|
||||||
ParseNamespaceItem *nsitem;
|
ParseNamespaceItem *nsitem;
|
||||||
|
@ -545,7 +545,7 @@ typedef struct ResultRelInfo
|
|||||||
OnConflictSetState *ri_onConflict;
|
OnConflictSetState *ri_onConflict;
|
||||||
|
|
||||||
/* for MERGE, lists of MergeActionState (one per MergeMatchKind) */
|
/* 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 */
|
/* for MERGE, expr state for checking the join condition */
|
||||||
ExprState *ri_MergeJoinCondition;
|
ExprState *ri_MergeJoinCondition;
|
||||||
|
@ -1970,6 +1970,8 @@ typedef enum MergeMatchKind
|
|||||||
MERGE_WHEN_NOT_MATCHED_BY_TARGET
|
MERGE_WHEN_NOT_MATCHED_BY_TARGET
|
||||||
} MergeMatchKind;
|
} MergeMatchKind;
|
||||||
|
|
||||||
|
#define NUM_MERGE_MATCH_KINDS (MERGE_WHEN_NOT_MATCHED_BY_TARGET + 1)
|
||||||
|
|
||||||
typedef struct MergeAction
|
typedef struct MergeAction
|
||||||
{
|
{
|
||||||
NodeTag type;
|
NodeTag type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user