Two macros are added in this module, to cut duplicated patterns: - PG_ARG_GETBITMAPSET(), for input argument handling, with knowledge about NULL. - PG_RETURN_BITMAPSET_AS_TEXT(), that generates a text result from a Bitmapset. These changes limit the code so as the SQL functions are now mostly wrappers of the equivalent C function. Functions that use integer input arguments still need some NULL handling, like bms_make_singleton(). A NULL input is translated to "<>", which is what nodeToString() generates. Some of the tests are able to generate this result. Per discussion, the calls of bms_free() are removed. These may be justified if the functions are used in a rather long-lived memory context, but let's keep the code minimal for now. These calls used NULL checks, which were also not necessary as NULL is an input authorized by bms_free(). Some of the tests existed to cover behaviors related to the SQL functions for NULL inputs. Most of them are still relevant, as the routines of bitmapset.c are able to handle such cases. The coverage reports of bitmapset.c and test_bitmapset.c remain the same after these changes, with 300 lines of C code removed. Author: David Rowley <dgrowleyml@gmail.com> Co-authored-by: Greg Burd <greg@burd.me> Discussion: https://postgr.es/m/CAApHDvqghMnm_zgSNefto9oaEJ0S-3Cgb3gdsV7XvLC-hMS02Q@mail.gmail.com
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.