Re: Propose a new function - list_is_empty
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Peter Smith <smithpb2250@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-08-16T13:37:51Z
Lists: pgsql-hackers
Daniel Gustafsson <daniel@yesql.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
Commits
-
Avoid using list_length() to test for empty list.
- efd0c16becbf 16.0 landed