git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f6e8451)
Use macro NUM_MERGE_MATCH_KINDS instead of '3' in MERGE code.
2024年4月19日 08:40:20 +0000 (09:40 +0100)
2024年4月19日 08:40:20 +0000 (09:40 +0100)
Code quality improvement for 0294df2f1f84.

Aleksander Alekseev, reviewed by Richard Guo.

Discussion: https://postgr.es/m/CAJ7c6TMsiaV5urU_Pq6zJ2tXPDwk69-NKVh4AMN5XrRiM7N%2BGA%40mail.gmail.com


diff --git a/src/backend/optimizer/prep/prepjointree.c b/src/backend/optimizer/prep/prepjointree.c
index fb768ad52c2a1c44bc83c950720c7457056c3f59..41da670f1506ecee67c1f80c6b1f9bba0bce195f 100644 (file)
--- a/src/backend/optimizer/prep/prepjointree.c
+++ b/src/backend/optimizer/prep/prepjointree.c
@@ -153,7 +153,7 @@ transform_MERGE_to_join(Query *parse)
{
RangeTblEntry *joinrte;
JoinExpr *joinexpr;
- bool have_action[3];
+ bool have_action[NUM_MERGE_MATCH_KINDS];
JoinType jointype;
int joinrti;
List *vars;
diff --git a/src/backend/parser/parse_merge.c b/src/backend/parser/parse_merge.c
index bce11d59561debf5fa4c990d8c8e91a92275c0ca..87df79027d7fb3169d66f9f5966646342ddaa8d9 100644 (file)
--- a/src/backend/parser/parse_merge.c
+++ b/src/backend/parser/parse_merge.c
@@ -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;
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index fa2f70b7a4894104ba5ec7dfccf207a43147bc93..c1a65bad2a988363f7110712e7b52da94d26a2fc 100644 (file)
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -545,7 +545,7 @@ typedef struct ResultRelInfo
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;
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 719c4b7b6156c2010f380f8a92b2237a92f2a735..247cecb4b4574244362c94d7da9400ac9ab935d5 100644 (file)
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -1970,6 +1970,8 @@ typedef enum MergeMatchKind
MERGE_WHEN_NOT_MATCHED_BY_TARGET
} MergeMatchKind;
+#define NUM_MERGE_MATCH_KINDS (MERGE_WHEN_NOT_MATCHED_BY_TARGET + 1)
+
typedef struct MergeAction
{
NodeTag type;
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /