Fix incorrectly reported stats kind in "can't happen" ERROR
authorDavid Rowley <drowley@postgresql.org>
Tue, 5 Mar 2024 03:17:02 +0000 (16:17 +1300)
committerDavid Rowley <drowley@postgresql.org>
Tue, 5 Mar 2024 03:17:02 +0000 (16:17 +1300)
The error message(s) were reporting the stats kind of 'f', which is not
correct as that's for the "dependencies" statistics kind.

Reported-by: Horst Reiterer
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/18375-ba99383eb9062d6a@postgresql.org
Backpatch-through: 12, where MCV extended stats were added.

src/backend/statistics/extended_stats.c
src/backend/statistics/mcv.c

index 749e99d53a42cf5596d593abdede03fa5e1b5859..5d7bdc9d12a27ed36c78ae85bb2b4564172c24bc 100644 (file)
@@ -2440,7 +2440,7 @@ statext_expressions_load(Oid stxoid, bool inh, int idx)
    if (isnull)
        elog(ERROR,
             "requested statistics kind \"%c\" is not yet built for statistics object %u",
-            STATS_EXT_DEPENDENCIES, stxoid);
+            STATS_EXT_EXPRESSIONS, stxoid);
 
    eah = DatumGetExpandedArray(value);
 
index 2b5ad434f78c65f22ddc8bf9bef6f14d38fefd73..b0e9aead84e976473e48a7fb987f4f495d9248bb 100644 (file)
@@ -572,7 +572,7 @@ statext_mcv_load(Oid mvoid, bool inh)
    if (isnull)
        elog(ERROR,
             "requested statistics kind \"%c\" is not yet built for statistics object %u",
-            STATS_EXT_DEPENDENCIES, mvoid);
+            STATS_EXT_MCV, mvoid);
 
    result = statext_mcv_deserialize(DatumGetByteaP(mcvlist));