postgresql/src/backend/catalog
Tom Lane efd0c16bec Avoid using list_length() to test for empty list.
The standard way to check for list emptiness is to compare the
List pointer to NIL; our list code goes out of its way to ensure
that that is the only representation of an empty list.  (An
acceptable alternative is a plain boolean test for non-null
pointer, but explicit mention of NIL is usually preferable.)

Various places didn't get that memo and expressed the condition
with list_length(), which might not be so bad except that there
were such a variety of ways to check it exactly: equal to zero,
less than or equal to zero, less than one, yadda yadda.  In the
name of code readability, let's standardize all those spellings
as "list == NIL" or "list != NIL".  (There's probably some
microscopic efficiency gain too, though few of these look to be
at all performance-critical.)

A very small number of cases were left as-is because they seemed
more consistent with other adjacent list_length tests that way.

Peter Smith, with bikeshedding from a number of us

Discussion: https://postgr.es/m/CAHut+PtQYe+ENX5KrONMfugf0q6NHg4hR5dAhqEXEc2eefFeig@mail.gmail.com
2022-08-17 11:12:35 -04:00
..
.gitignore Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
aclchk.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
catalog.c Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
Catalog.pm Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
dependency.c Close old gap in dependency checks for functions returning composite. 2022-07-22 12:46:42 -04:00
genbki.pl Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
heap.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
index.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
indexing.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
information_schema.sql Fix bogus dependency handling for GENERATED expressions. 2022-03-21 14:58:49 -04:00
Makefile Allow granting SET and ALTER SYSTEM privileges on GUC parameters. 2022-04-06 13:24:33 -04:00
namespace.c Fix temporary object cleanup failing due to toast access without snapshot. 2022-02-21 08:57:34 -08:00
objectaccess.c Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
objectaddress.c Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
partition.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_aggregate.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_attrdef.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
pg_cast.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
pg_class.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_collation.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
pg_constraint.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
pg_conversion.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_db_role_setting.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_depend.c Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
pg_enum.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_inherits.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_largeobject.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_namespace.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_operator.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
pg_parameter_acl.c Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
pg_proc.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
pg_publication.c Move common catalog cache access routines to lsyscache.c 2022-08-02 10:47:22 +05:30
pg_range.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_shdepend.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_subscription.c Move common catalog cache access routines to lsyscache.c 2022-08-02 10:47:22 +05:30
pg_type.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
sql_feature_packages.txt Cleanup in SQL features files 2020-03-28 08:46:18 +01:00
sql_features.txt Update SQL features 2022-05-06 09:17:38 +02:00
storage.c Change internal RelFileNode references to RelFileNumber or RelFileLocator. 2022-07-06 11:39:09 -04:00
system_functions.sql Support pg_read_[binary_]file (filename, missing_ok). 2022-07-29 15:38:49 -04:00
system_views.sql Allow users to skip logical replication of data having origin. 2022-07-21 08:47:38 +05:30
toasting.c Add UNIQUE null treatment option 2022-02-03 11:48:21 +01:00