Re: tablecmds.c/MergeAttributes() cleanup

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tablecmds.c/MergeAttributes() cleanup
Date: 2023-08-30 14:46:50
Message-ID: 20230830144650.m3ajpsk52sbieahv@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-Aug-29, Nathan Bossart wrote:

> On Tue, Aug 29, 2023 at 08:44:02PM +0200, Alvaro Herrera wrote:

> > Makes sense. However, maybe we should replace those ugly defines and
> > their hardcoded values in DefineSequence with a proper array with their
> > names and datatypes.
>
> That might be an improvement, but IIUC you'd still need to enumerate all of
> the columns or data types to make sure you use the right get-Datum
> function. It doesn't help that last_value uses Int64GetDatumFast and
> log_cnt uses Int64GetDatum. I could be missing something, though.

Well, for sure I meant to enumerate everything that was needed,
including the initializer for the value. Like in the attached patch.

However, now that I've actually written it, I don't find it so pretty
anymore, but maybe that's just because I don't know how to write the
array assignment as a single statement instead of a separate statement
for each column.

But this should silence the warnings, anyway.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

Attachment Content-Type Size
seq-warnings.patch text/x-diff 3.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2023-08-30 14:49:47 Re: trying again to get incremental backup
Previous Message Nathan Bossart 2023-08-30 14:27:55 Re: pg_stat_get_backend_subxact() and backend IDs?