add constants for enum length
authorRobert Haas <rhaas@postgresql.org>
Fri, 27 Jun 2025 14:50:02 +0000 (10:50 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 27 Jun 2025 14:50:02 +0000 (10:50 -0400)
contrib/pg_plan_advice/pgpa_join.h

index 34992afc8120fc10386851db04e0d1327bc21b4d..ee56e24a1c98543fe3f58fdeba6e2ae81a8ed8ff 100644 (file)
@@ -37,11 +37,14 @@ typedef struct pgpa_unrolled_join pgpa_unrolled_join;
  */
 typedef enum
 {
-       JSTRAT_CLUMP_DEGENERATE,
+       JSTRAT_CLUMP_DEGENERATE = 0,
        JSTRAT_CLUMP_FOREIGN,
        JSTRAT_CLUMP_PARTITIONWISE
+       /* update NUM_PGPA_CLUMP_JOIN_STRATEGY if you add anything here */
 } pgpa_join_clump_strategy;
 
+#define NUM_PGPA_CLUMP_JOIN_STRATEGY   ((int) JSTRAT_CLUMP_PARTITIONWISE)
+
 /*
  * All of the details we need regarding a clumped join.
  */
@@ -62,14 +65,17 @@ typedef struct
  */
 typedef enum
 {
-       JSTRAT_MERGE_JOIN_PLAIN,
+       JSTRAT_MERGE_JOIN_PLAIN = 0,
        JSTRAT_MERGE_JOIN_MATERIALIZE,
        JSTRAT_NESTED_LOOP_PLAIN,
        JSTRAT_NESTED_LOOP_MATERIALIZE,
        JSTRAT_NESTED_LOOP_MEMOIZE,
        JSTRAT_HASH_JOIN
+       /* update NUM_PGPA_JOIN_STRATEGY if you add anything here */
 } pgpa_join_strategy;
 
+#define NUM_PGPA_JOIN_STRATEGY         ((int) JSTRAT_HASH_JOIN)
+
 /*
  * Within a pgpa_unrolled_join, we may need to refer to either to scans or to
  * other joins, which may be either unrolled or clumped.