Re: POC: converting Lists into arrays - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: POC: converting Lists into arrays
Date
Msg-id 20190227214137.GA20958@alvherre.pgsql
Whole thread Raw
In response to Re: POC: converting Lists into arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2019-Feb-27, Tom Lane wrote:

> I'm particularly unsure about whether we need two macros; though the
> way I initially tried it with just list_cell_is_last() seemed kind of
> double-negatively confusing in the places where the test needs to be
> not-last.  Also, are these macro names too long, and if so what would
> be better?

I think "!list_cell_is_last()" is just as readable, if not more, than
the "is_not_last" locution:

        appendStringInfoChar(&buf, '\'');
        if (!list_cell_is_last(l))
            appendStringInfoString(&buf, ", ");

I'd go with a single macro.


+1 for backpatching the new macros, too.  I suspect extension authors
are going to need to provide compatibility versions anyway, to be
compilable against older minors.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Why don't we have a small reserved OID range for patch revisions?
Next
From: Thomas Munro
Date:
Subject: Re: Refactoring the checkpointer's fsync request queue