- use fallthrough attribute instead of comment for PG 19 master
authorTeodor Sigaev <teodor@sigaev.ru>
Wed, 8 Jul 2026 10:01:12 +0000 (13:01 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Wed, 8 Jul 2026 10:01:12 +0000 (13:01 +0300)
- use resultRelationRelids instead of resultRelations for PG 19
- fix "unannotated fall-through between switch labels"
- fix "function declaration isn’t a prototype"
- pass VacuumParams as pointer (per Since upstream commit 771fe0948ca)

Marina Polyakova, Anton Voloshin

online_analyze.c

index 89c9e24..ba967af 100644 (file)
@@ -314,7 +314,7 @@ includeTablesAssign(const char * newval, bool doit, GucSource source)
 #endif
 
 static void
-lateInit()
+lateInit(void)
 {
        TableList       *tl[] = {&includeTables, &excludeTables};
        int i;
@@ -651,11 +651,7 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected)
 #if PG_VERSION_NUM < 120000
                        flags,
 #endif
-#if PG_VERSION_NUM >= 190000
-                       vacstmt,
-#else
                        &vacstmt,
-#endif
                        NULL, true, GetAccessStrategy(BAS_VACUUM)
 #endif
                );
@@ -684,6 +680,9 @@ makeAnalyze(Oid relOid, CmdKind operation, int64 naffected)
                        case CK_INSERT:
                        case CK_UPDATE:
                                rstat->n_tuples += naffected;
+#if PG_VERSION_NUM >= 190000
+                               pg_fallthrough;
+#endif
                                /* FALLTHROUGH */
                        case CK_DELETE:
                                rstat->rereadStat = (reltype == OATT_PERSISTENT);
@@ -851,14 +850,25 @@ onlineAnalyzeHooker(QueryDesc *queryDesc)
                }
                else
 #endif
+#if PG_VERSION_NUM >= 190000
+               if (!bms_is_empty(queryDesc->plannedstmt->resultRelationRelids) &&
+#else
                if (queryDesc->plannedstmt->resultRelations &&
+#endif
                                 queryDesc->plannedstmt->rtable)
                {
+#if PG_VERSION_NUM >= 190000
+                       int                     n = -1;
+
+                       while ((n = bms_next_member(queryDesc->plannedstmt->resultRelationRelids, n)) >= 0)
+                       {
+#else
                        ListCell        *l;
 
                        foreach(l, queryDesc->plannedstmt->resultRelations)
                        {
                                int                             n = lfirst_int(l);
+#endif
                                RangeTblEntry   *rte = list_nth(queryDesc->plannedstmt->rtable, n-1);
 
                                if (rte->rtekind == RTE_RELATION)
@@ -889,6 +899,10 @@ removeTable(XactEvent event, void *arg)
                        break;
                case XACT_EVENT_ABORT:
                        toremove = NIL;
+#if PG_VERSION_NUM >= 190000
+                       pg_fallthrough;
+#endif
+                       /* FALLTHROUGH */
                default:
                        return;
        }