Complete the TODOs in to_json_is_immutable() and to_jsonb_is_immutable() by recursing into container types (arrays, composites, ranges, multiranges, domains) to check element/sub-type mutability, rather than conservatively returning "mutable" for all arrays and composites. The shared logic is factored into a single json_check_mutability() function in jsonfuncs.c, with the existing exported functions as thin wrappers. Composite type inspection uses lookup_rowtype_tupdesc() (typcache) instead of relation_open() to avoid unnecessary lock acquisition in the optimizer. Range and multirange types are now also checked recursively: if the subtype's conversion is immutable, the range is considered immutable for JSON purposes, even though range_out is generically marked STABLE. This is a behavioral change: range types with immutable subtypes (e.g., int4range) can now appear in expression indexes via JSON_ARRAY/JSON_OBJECT, whereas previously they were conservatively rejected. Add regression tests for JSON_ARRAY and JSON_OBJECT mutability with expression indexes and generated columns, covering arrays, composites, domains, ranges, multiranges and combinations thereof. Author: Jian He <jian.universality@gmail.com> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Discussion: https://postgr.es/m/CACJufxFz=OsXQdsMJ-cqoqspD9aJrwntsQP-U2A-UaV_M+-S9g@mail.gmail.com Commitfest: https://commitfest.postgresql.org/patch/5759 |
||
|---|---|---|
| .github | ||
| config | ||
| contrib | ||
| doc | ||
| src | ||
| .cirrus.star | ||
| .cirrus.tasks.yml | ||
| .cirrus.yml | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .mailmap | ||
| aclocal.m4 | ||
| configure | ||
| configure.ac | ||
| COPYRIGHT | ||
| GNUmakefile.in | ||
| HISTORY | ||
| Makefile | ||
| meson.build | ||
| meson_options.txt | ||
| README.md | ||
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/.