Re: Propose a new function - list_is_empty

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Propose a new function - list_is_empty
Date: 2022-08-16 13:37:51
Message-ID: 1116757.1660657071@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> I think these are nice cleanups to simplify and streamline the code, just a few
> small comments from reading the patch:

> /* If no subcommands, don't collect */
> - if (list_length(currentEventTriggerState->currentCommand->d.alterTable.subcmds) != 0)
> + if (currentEventTriggerState->currentCommand->d.alterTable.subcmds)
> Here the current coding gives context about the data structure used for the
> subcmds member which is now lost. I don't mind the change but rewording the
> comment above to indicate that subcmds is a list would be good IMHO.

I think testing for equality to NIL is better where that's a concern.

> Might be personal taste, but I think the parenthesis should be kept here as a
> visual aid for the reader.

+1

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-08-16 13:47:56 Re: Propose a new function - list_is_empty
Previous Message Drouvot, Bertrand 2022-08-16 12:49:04 Re: shared-memory based stats collector - v70