| From: | Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> |
|---|---|
| To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)postgresql(dot)org, jkatz(at)postgresql(dot)org, nathandbossart(at)gmail(dot)com |
| Subject: | Re: Import Statistics in postgres_fdw before resorting to sampling. |
| Date: | 2026-05-14 11:35:30 |
| Message-ID: | CAPmGK17sR1DBrrpx9oPTkbb04+aDCivWMmKh3OCYEmbqJ1ciNg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, May 13, 2026 at 8:40 PM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
> On Tue, May 12, 2026 at 8:36 PM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
> > On Fri, May 1, 2026 at 3:04 AM Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
> > > The second gets rid of the string buffers entirely, and instead frees the nested object.
> > >
> > > I have no preference between the two, though I suspect that the nested-free solution will be preferred by the community.
> >
> > ISTM that the second solution is the right direction to go in.
> >
> > +static void
> > +free_remattrmap(RemoteAttributeMapping *map, int len)
> > +{
> > + if (!map)
> > + return;
> > +
> > + for (int i = 0; i < len; i++)
> > + {
> > + if (map[i].local_attname)
> > + pfree(map[i].local_attname);
> > + if (map[i].remote_attname)
> > + pfree(map[i].remote_attname);
> > + }
> >
> > The if tests for local_attname/remote_attname should be assertions?
>
> I mean that by the definition of build_remattrmap(), the
> local_attname/remote_attname cannot be NULL if the given map isn't
> NULL, so the if tests are just a waste of cycles. So I modified the
> patch as such. Updated patch attached. I also removed an extra
> change made to RemoteAttributeMapping, which seemed irrelevant to this
> issue to me.
I'll push the updated patch if no objections from you (or anyone else).
Best regards,
Etsuro Fujita
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Dunstan | 2026-05-14 12:29:16 | Re: Fix jsonpath .split_part() to honor silent mode |
| Previous Message | r314tive | 2026-05-14 11:19:45 | [RFC PATCH v1] Add EXPLAIN ANALYZE wait event reporting |