postgresql/src/test/modules
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
..
brin Remove unportable use of timezone in recent test 2022-08-07 10:19:40 +02:00
commit_ts Replace Test::More plans with done_testing 2022-02-11 20:54:44 +01:00
delay_execution Remove now superfluous declarations of dlsym()ed symbols. 2022-07-17 17:29:32 -07:00
dummy_index_am Remove now superfluous declarations of dlsym()ed symbols. 2022-07-17 17:29:32 -07:00
dummy_seclabel Remove now superfluous declarations of dlsym()ed symbols. 2022-07-17 17:29:32 -07:00
libpq_pipeline Remove configure probe for sys/select.h. 2022-08-14 00:09:47 +12:00
plsample Extend plsample example to include a trigger handler. 2022-04-07 18:26:20 -04:00
snapshot_too_old Reduce test runtime of src/test/modules/snapshot_too_old. 2022-08-03 11:14:55 -04:00
spgist_name_ops pg_upgrade: Preserve relfilenodes and tablespace OIDs. 2022-01-17 13:40:27 -05:00
ssl_passphrase_callback Remove now superfluous declarations of dlsym()ed symbols. 2022-07-17 17:29:32 -07:00
test_bloomfilter Update copyright for 2022 2022-01-07 19:04:57 -05:00
test_ddl_deparse Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
test_extensions Stabilize output of new regression test. 2022-08-08 12:16:01 -04:00
test_ginpostinglist Update copyright for 2022 2022-01-07 19:04:57 -05:00
test_integerset Update copyright for 2022 2022-01-07 19:04:57 -05:00
test_lfind Introduce optimized routine for linear searches of arrays 2022-08-10 10:48:29 +07:00
test_misc Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
test_oat_hooks Fix typo in test_oat_hooks README 2022-08-10 13:49:48 +02:00
test_parser Update copyright for 2022 2022-01-07 19:04:57 -05:00
test_pg_dump Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
test_predtest Replace many MemSet calls with struct initialization 2022-07-16 08:50:49 +02:00
test_rbtree Add missing inequality searches to rbtree 2022-07-08 22:00:03 +03:00
test_regex Update copyright for 2022 2022-01-07 19:04:57 -05:00
test_rls_hooks Remove now superfluous declarations of dlsym()ed symbols. 2022-07-17 17:29:32 -07:00
test_shm_mq Mark all symbols exported from extension libraries PGDLLEXPORT. 2022-07-17 18:50:14 -07:00
unsafe_tests Fix missed corner cases for grantable permissions on GUCs. 2022-07-19 17:21:55 -04:00
worker_spi Mark all symbols exported from extension libraries PGDLLEXPORT. 2022-07-17 18:50:14 -07:00
Makefile Introduce optimized routine for linear searches of arrays 2022-08-10 10:48:29 +07:00
README Add an enforcement mechanism for global object names in regression tests. 2019-06-29 11:34:00 -04:00

Test extensions and libraries
=============================

src/test/modules contains PostgreSQL extensions that are primarily or entirely
intended for testing PostgreSQL and/or to serve as example code. The extensions
here aren't intended to be installed in a production server and aren't suitable
for "real work".

Furthermore, while you can do "make install" and "make installcheck" in
this directory or its children, it is NOT ADVISABLE to do so with a server
containing valuable data.  Some of these tests may have undesirable
side-effects on roles or other global objects within the tested server.
"make installcheck-world" at the top level does not recurse into this
directory.

Most extensions have their own pg_regress tests or isolationtester specs. Some
are also used by tests elsewhere in the tree.

If you're adding new hooks or other functionality exposed as C-level API this
is where to add the tests for it.