postgresql/src/include
Amit Langote f95c5090d9 SQL/JSON: Fix casting for integer EXISTS columns in JSON_TABLE
The current method of coercing the boolean result value of
JsonPathExists() to the target type specified for an EXISTS column,
which is to call the type's input function via json_populate_type(),
leads to an error when the target type is integer, because the
integer input function doesn't recognize boolean literal values as
valid.

Instead use the boolean-to-integer cast function for coercion in that
case so that using integer or domains thereof as type for EXISTS
columns works. Note that coercion for ON ERROR values TRUE and FALSE
already works like that because the parser creates a cast expression
including the cast function, but the coercion of the actual result
value is not handled by the parser.

Tests by Jian He.

Reported-by: Jian He <jian.universality@gmail.com>
Author: Jian He <jian.universality@gmail.com>
Author: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.com
Backpatch-through: 17
2024-07-30 10:39:28 +09:00
..
access Wait for WAL summarization to catch up before creating .partial file. 2024-07-26 14:51:10 -04:00
archive Add macro for customizing an archiving WARNING message. 2024-03-04 15:41:42 -06:00
backup Align blocks in incremental backups to BLCKSZ 2024-04-05 16:30:01 +02:00
bootstrap Update copyright for 2024 2024-01-03 20:49:05 -05:00
catalog Do not summarize WAL if generated with wal_level=minimal. 2024-07-18 12:19:29 -04:00
commands When creating materialized views, use REFRESH to load data. 2024-07-16 15:41:22 -07:00
common parse_manifest: Use const char * 2024-06-21 07:53:30 +02:00
datatype Update copyright for 2024 2024-01-03 20:49:05 -05:00
executor SQL/JSON: Fix casting for integer EXISTS columns in JSON_TABLE 2024-07-30 10:39:28 +09:00
fe_utils Allow dbname to be written as part of connstring via pg_basebackup's -R option. 2024-03-21 10:50:33 +05:30
foreign Clean up more indent breakage from 6377e12a5. 2024-04-16 13:00:40 -04:00
jit Move resowner from common JitContext to LLVM specific 2024-07-19 10:27:54 +03:00
lib Prevent access of uninitialized memory in radix tree nodes 2024-06-21 17:29:39 +07:00
libpq Use PqMsg_* macros in more places. 2024-07-17 10:51:00 -05:00
mb Inline basic UTF-8 functions. 2024-03-20 09:40:57 -07:00
nodes SQL/JSON: Always coerce JsonExpr result at runtime 2024-06-28 21:58:13 +09:00
optimizer Fix asymmetry in setting EquivalenceClass.ec_sortref 2024-06-06 13:41:34 +03:00
parser Revert temporal primary keys and foreign keys 2024-05-16 08:17:46 +02:00
partitioning Implement ALTER TABLE ... SPLIT PARTITION ... command 2024-04-07 01:18:44 +03:00
pch Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Remove bogus assertion in pg_atomic_monotonic_advance_u64 2024-07-04 13:25:31 +02:00
portability Update copyright for 2024 2024-01-03 20:49:05 -05:00
postmaster Wait for WAL summarization to catch up before creating .partial file. 2024-07-26 14:51:10 -04:00
regex Cope with <regex.h> name clashes. 2024-07-06 11:23:40 +12:00
replication Fix possibility of logical decoding partial transaction changes. 2024-07-11 22:48:21 +09:00
rewrite Support MERGE into updatable views. 2024-02-29 15:56:59 +00:00
snowball Update copyright for 2024 2024-01-03 20:49:05 -05:00
statistics Update copyright for 2024 2024-01-03 20:49:05 -05:00
storage Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX. 2024-06-27 19:21:05 -07:00
tcop Fix incorrect year in some copyright notices added this year 2024-05-15 15:01:21 +12:00
tsearch Update copyright for 2024 2024-01-03 20:49:05 -05:00
utils Fix using injection points at backend startup in EXEC_BACKEND mode 2024-07-26 15:12:12 +03:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Add macro to disable address safety instrumentation 2024-04-06 12:20:40 +07:00
fmgr.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
funcapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
getopt_long.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
Makefile Put genbki.pl output into src/include/catalog/ directly 2024-03-14 07:11:21 +01:00
meson.build meson: Restore implicit warning/debug/optimize flags for extensions 2024-06-07 09:36:26 +02:00
miscadmin.h Remove assertions that some compiler say are tautological 2024-03-20 09:14:51 +02:00
pg_config.h.in Fix macro placement in pg_config.h.in 2024-07-26 16:25:56 +02:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.meson meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_config_manual.h Introduce a non-recursive JSON parser 2024-04-04 06:46:40 -04:00
pg_getopt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_trace.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgstat.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtar.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtime.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
port.h Replace calls to pg_qsort() with the qsort() macro. 2024-02-16 11:37:50 -06:00
postgres.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
postgres_ext.h Move RelFileNumber declarations to common/relpath.h. 2022-09-27 12:01:57 -04:00
postgres_fe.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
varatt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
windowapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00