postgresql/contrib
Tom Lane 0986e95161 Revise APIs for pushJsonbValue() and associated routines.
Instead of passing "JsonbParseState **" to pushJsonbValue(),
pass a pointer to a JsonbInState, which will contain the
parseState stack pointer as well as other useful fields.
Also, instead of returning a JsonbValue pointer that is often
meaningless/ignored, return the top-level JsonbValue pointer
in the "result" field of the JsonbInState.

This involves a lot of (mostly mechanical) edits, but I think
the results are notationally cleaner and easier to understand.
Certainly the business with sometimes capturing the result of
pushJsonbValue() and sometimes not was bug-prone and incapable of
mechanical verification.  In the new arrangement, JsonbInState.result
remains null until we've completed a valid sequence of pushes, so
that an incorrect sequence will result in a null-pointer dereference,
not mistaken use of a partial result.

However, this isn't simply an exercise in prettier notation.
The real reason for doing it is to provide a mechanism whereby
pushJsonbValue() can be told to construct the JsonbValue tree
in a context that is not CurrentMemoryContext.  That happens
when a non-null "outcontext" is specified in the JsonbInState.
No callers exercise that option in this patch, but the next
patch in the series will make use of it.

I tried to improve the comments in this area too.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/1060917.1753202222@sss.pgh.pa.us
2025-12-07 11:51:33 -05:00
..
amcheck Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
auth_delay Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
auto_explain Allow resetting unknown custom GUCs with reserved prefixes. 2025-08-01 16:52:11 -05:00
basebackup_to_shell Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
basic_archive Remove translation marker from libpq-be-fe-helpers.h. 2025-07-22 22:08:36 +09:00
bloom Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
bool_plperl Fix erroneous construction of functions' dependencies on transforms. 2025-04-07 13:31:37 -04:00
btree_gin Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
btree_gist Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
citext Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
cube Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
dblink Use CompactAttribute more often, when possible 2025-10-22 11:36:26 +13:00
dict_int Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
dict_xsyn Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
earthdistance Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
file_fdw Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
fuzzystrmatch Remove useless casting to same type 2025-12-02 10:09:32 +01:00
hstore Revise APIs for pushJsonbValue() and associated routines. 2025-12-07 11:51:33 -05:00
hstore_plperl Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
hstore_plpython Remove circular #include's between plpython.h and plpy_util.h. 2025-04-27 11:43:02 -04:00
intagg Update copyright for 2025 2025-01-01 11:21:55 -05:00
intarray Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
isn Fix various incorrect filename references 2025-09-22 13:33:17 +12:00
jsonb_plperl Revise APIs for pushJsonbValue() and associated routines. 2025-12-07 11:51:33 -05:00
jsonb_plpython Revise APIs for pushJsonbValue() and associated routines. 2025-12-07 11:51:33 -05:00
lo Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
ltree Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
ltree_plpython Remove circular #include's between plpython.h and plpy_util.h. 2025-04-27 11:43:02 -04:00
oid2name Update copyright for 2025 2025-01-01 11:21:55 -05:00
pageinspect Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
passwordcheck Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
pg_buffercache pg_buffercache: Add pg_buffercache_mark_dirty{,_relation,_all}() 2025-11-28 09:04:04 +09:00
pg_freespacemap Prevent assertion failure in contrib/pg_freespacemap. 2025-03-27 13:20:23 -04:00
pg_logicalinspect Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
pg_overexplain Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
pg_prewarm bufmgr: Allow some buffer state modifications while holding header lock 2025-11-06 16:42:10 -05:00
pg_stat_statements pg_stat_statements: Fix handling of duplicate constant locations 2025-10-29 12:35:02 +01:00
pg_surgery Fix some confusing uses of const 2025-10-30 11:20:04 +01:00
pg_trgm Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
pg_visibility Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
pg_walinspect Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
pgcrypto Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
pgrowlocks Add missing Datum conversions 2025-08-08 22:06:57 +02:00
pgstattuple pgstattuple: Improve reports generated for indexes (hash, gist, btree) 2025-10-02 11:07:30 +09:00
postgres_fdw Have the planner replace COUNT(ANY) with COUNT(*), when possible 2025-11-27 10:43:28 +13:00
seg Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
sepgsql Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
spi Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
sslinfo Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
start-scripts Remove gratuitous references to postmaster program 2023-01-26 10:48:32 +01:00
tablefunc Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
tcn Use stack allocated StringInfoDatas, where possible 2025-11-06 14:59:48 +13:00
test_decoding Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
tsm_system_rows Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
tsm_system_time Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
unaccent Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
uuid-ossp Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
vacuumlo Update copyright for 2025 2025-01-01 11:21:55 -05:00
xml2 Use more palloc_object() and palloc_array() in contrib/ 2025-12-05 16:40:26 +09:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00
Makefile pg_overexplain: Additional EXPLAIN options for debugging. 2025-03-26 13:52:21 -04:00
meson.build pg_overexplain: Additional EXPLAIN options for debugging. 2025-03-26 13:52:21 -04:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.