On 8/9/26 00:08, Tomas Vondra wrote:
> ...
>
> 0002 - Unify extended statistics columns and expressions
>
> I think there's a couple issuses.
>
> - The psql describe code still checks (sversion >= 190000), but that's
> now wrong, it needs to check 200000. A simple rebase omission, but
> it can lead to failures on 19.
>
I noticed another minor issue in the psql describe code, in parsing the
statistics definition. If you do this
create statistics "aaaa ON bbbb" (mcv) ON a, b, c FROM t;
then "\d t" shows
Statistics objects:
"public.aaaa ON bbbb" (mcv) ON bbbb" (mcv) ON a, b, c FROM t
which is clearly confused. AFIAK this happens because
pg_get_statisticsobjdef_columns_from does about this
res = pg_get_statisticsobj_worker(statextid, true);
...
on_ptr = strstr(res, " ON ");
but the strstr() fails to consider the stxname could already contain the
string " ON ", and gets confused by it.
I think it could be fixed by adding a flag to
pg_get_statisticsobj_worker, to simply not generate the initial part at
all (and then the strstr is not needed at all). Or maybe it could return
the offset where the columns begin, also makes strstr unnecessary.
regards
--
Tomas Vondra