git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 5e05a0e) | patch
SQL/JSON: Correct jsonpath variable name matching
2024年6月19日 06:22:06 +0000 (15:22 +0900)
2024年6月19日 06:22:06 +0000 (15:22 +0900)
commit 0f271e8e8d9c8db0ea86c0d12b3221009b81d8bf
SQL/JSON: Correct jsonpath variable name matching

Previously, GetJsonPathVar() allowed a jsonpath expression to
reference any prefix of a PASSING variable's name. For example, the
following query would incorrectly work:

SELECT JSON_QUERY(context_item, jsonpath '$xy' PASSING val AS xyz);

The fix ensures that the length of the variable name mentioned in a
jsonpath expression matches exactly with the name of the PASSING
variable before comparing the strings using strncmp().

Reported-by: Alvaro Herrera (off-list)
Discussion: https://postgr.es/m/CA+HiwqFGkLWMvELBH6E4SQ45qUHthgcRH6gCJL20OsYDRtFx_w@mail.gmail.com
src/backend/executor/execExpr.c diff | blob | blame | history
src/backend/utils/adt/jsonpath_exec.c diff | blob | blame | history
src/include/utils/jsonpath.h diff | blob | blame | history
src/test/regress/expected/sqljson_queryfuncs.out diff | blob | blame | history
src/test/regress/sql/sqljson_queryfuncs.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /