Re: Propose a new function - list_is_empty
От
Tom Lane
Тема
Re: Propose a new function - list_is_empty
Дата
Msg-id
1004027.1660613276@sss.pgh.pa.us
Ответ на
Propose a new function - list_is_empty (Peter Smith)
Список
Дерево обсуждения
Propose a new function - list_is_empty Peter Smith <smithpb2250@gmail.com>
Re: Propose a new function - list_is_empty Tom Lane <tgl@sss.pgh.pa.us>
Re: Propose a new function - list_is_empty Robert Haas <robertmhaas@gmail.com>
Re: Propose a new function - list_is_empty Tom Lane <tgl@sss.pgh.pa.us>
Re: Propose a new function - list_is_empty Daniel Gustafsson <daniel@yesql.se>
Re: Propose a new function - list_is_empty Peter Smith <smithpb2250@gmail.com>
Re: Propose a new function - list_is_empty Daniel Gustafsson <daniel@yesql.se>
Re: Propose a new function - list_is_empty Junwang Zhao <zhjwpku@gmail.com>
Re: Propose a new function - list_is_empty Tom Lane <tgl@sss.pgh.pa.us>
Re: Propose a new function - list_is_empty Tom Lane <tgl@sss.pgh.pa.us>
Re: Propose a new function - list_is_empty Peter Smith <smithpb2250@gmail.com>
Re: Propose a new function - list_is_empty Daniel Gustafsson <daniel@yesql.se>
Re: Propose a new function - list_is_empty Peter Smith <smithpb2250@gmail.com>
Re: Propose a new function - list_is_empty Daniel Gustafsson <daniel@yesql.se>
Re: Propose a new function - list_is_empty Tom Lane <tgl@sss.pgh.pa.us>
Re: Propose a new function - list_is_empty Peter Smith <smithpb2250@gmail.com>
Peter Smith writes: > During a recent code review I was going to suggest that some new code > would be more readable if the following: > if (list_length(alist) == 0) ... > was replaced with: > if (list_is_empty(alist)) ... > but then I found that actually no such function exists. That's because the *correct* way to write it is either "alist == NIL" or just "!alist". I don't think we need yet another way to spell that, and I'm entirely not on board with replacing either of those idioms. But if you want to get rid of overcomplicated uses of list_length() in favor of one of those spellings, have at it. regards, tom lane
В списке pgsql-hackers по дате отправления