Re: Add expressions to pg_restore_extended_stats()

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Tender Wang <tndrwang(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(at)vondra(dot)me>
Subject: Re: Add expressions to pg_restore_extended_stats()
Date: 2026-02-04 06:13:05
Message-ID: CADkLM=fJfDFcqp6EJGqvn2NFEnwVGhuvSnDWbuURo3JXJJNWgQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> > Mild change of subject, it seems that we can't get the expression fake
> > attnum context into the errors we re-throw in statatt_build_stavalues -
> it
> > might make sense to to bring a version of that function into
> > extended_stats_funcs where we can add the extra parameters for context
> (and
> > avoid the need for a text datum version of some longish strings that
> we've
> > already just converted from converting json-string to c-string. If I did
> > make a new function, then that'd be 2 statatt_* functions that no longer
> > need to be visible outside of attribute_stats.c. Thoughts on both making
> > the new function, and maybe sending a few of these statatts back to
> > static-land?
>
> Hmm. I am not sure, that depends. How much additional information
> would these extra parameter bring to the errors generated in
> statatt_build_stavalues().

Just the index of which expression and the name of the key that fed in the
offending value string.

> We could also set an error context
> callback (ErrorContextCallback) within import_pg_statistic() or in the
> loop that calls the routine, with some data based on the counter of
> "numexprs" to provide more context about where an error is happening.
>

If you think it would help, I'd be game for that. It's been a while since I
used one of those callbacks, though.

> I have used that in the past to avoid complicating functions across
> multiple levels of a stack (for example, see ReindexPartitions() in
> indexcmds.c with its ReindexErrorInfo).

This may be another such case.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-02-04 06:21:29 Re: Add LIMIT option to COPY FROM
Previous Message shveta malik 2026-02-04 06:02:29 Re: [Patch] add new parameter to pg_replication_origin_session_setup