Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e068db

Browse files
committed
Use macro NUM_MERGE_MATCH_KINDS instead of '3' in MERGE code.
Code quality improvement for0294df2.Aleksander Alekseev, reviewed by Richard Guo.Discussion:https://postgr.es/m/CAJ7c6TMsiaV5urU_Pq6zJ2tXPDwk69-NKVh4AMN5XrRiM7N%2BGA%40mail.gmail.com
1 parentf6e8451 commit2e068db

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

‎src/backend/optimizer/prep/prepjointree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ transform_MERGE_to_join(Query *parse)
153153
{
154154
RangeTblEntry*joinrte;
155155
JoinExpr*joinexpr;
156-
boolhave_action[3];
156+
boolhave_action[NUM_MERGE_MATCH_KINDS];
157157
JoinTypejointype;
158158
intjoinrti;
159159
List*vars;

‎src/backend/parser/parse_merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ transformMergeStmt(ParseState *pstate, MergeStmt *stmt)
109109
Query*qry=makeNode(Query);
110110
ListCell*l;
111111
AclModetargetPerms=ACL_NO_RIGHTS;
112-
boolis_terminal[3];
112+
boolis_terminal[NUM_MERGE_MATCH_KINDS];
113113
IndexsourceRTI;
114114
List*mergeActionList;
115115
ParseNamespaceItem*nsitem;

‎src/include/nodes/execnodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ typedef struct ResultRelInfo
545545
OnConflictSetState*ri_onConflict;
546546

547547
/* for MERGE, lists of MergeActionState (one per MergeMatchKind) */
548-
List*ri_MergeActions[3];
548+
List*ri_MergeActions[NUM_MERGE_MATCH_KINDS];
549549

550550
/* for MERGE, expr state for checking the join condition */
551551
ExprState*ri_MergeJoinCondition;

‎src/include/nodes/primnodes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,6 +1970,8 @@ typedef enum MergeMatchKind
19701970
MERGE_WHEN_NOT_MATCHED_BY_TARGET
19711971
}MergeMatchKind;
19721972

1973+
#defineNUM_MERGE_MATCH_KINDS (MERGE_WHEN_NOT_MATCHED_BY_TARGET + 1)
1974+
19731975
typedefstructMergeAction
19741976
{
19751977
NodeTagtype;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp