=== Applying patches on top of PostgreSQL commit ID 9b917a93116e6b8aac7ed837ded27696f7232505 ===
/etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf.
Thu Aug 6 09:38:33 UTC 2026
On branch cf/6429
nothing to commit, working tree clean
=== using 'git am' to apply patch ./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch ===
Applying: Add SQL/JSON ON MISMATCH clause to JSON_VALUE, JSON_QUERY, JSON_TABLE functions.
.git/rebase-apply/patch:564: indent with spaces.
json_behavior ON EMPTY_P json_behavior ON MISMATCH json_behavior ON ERROR_P
.git/rebase-apply/patch:565: indent with spaces.
{ $$ = list_make3($1, $4, $7); }
.git/rebase-apply/patch:567: indent with spaces.
| json_behavior ON EMPTY_P json_behavior ON ERROR_P
.git/rebase-apply/patch:568: indent with spaces.
{ $$ = list_make3($1, NULL, $4); }
.git/rebase-apply/patch:569: indent with spaces.
| json_behavior ON EMPTY_P json_behavior ON MISMATCH
warning: squelched 12 whitespace errors
warning: 17 lines add whitespace errors.
Using index info to reconstruct a base tree...
M doc/src/sgml/func/func-json.sgml
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/sql/sqljson_queryfuncs.sql
Falling back to patching base and 3-way merge...
Auto-merging src/test/regress/sql/sqljson_queryfuncs.sql
Auto-merging src/test/regress/expected/sqljson_queryfuncs.out
Auto-merging src/include/parser/kwlist.h
Auto-merging src/include/nodes/primnodes.h
Auto-merging src/include/nodes/parsenodes.h
Auto-merging src/include/nodes/execnodes.h
Auto-merging src/backend/utils/adt/ruleutils.c
Auto-merging src/backend/parser/parse_jsontable.c
Auto-merging src/backend/parser/parse_expr.c
Auto-merging src/backend/parser/gram.y
Auto-merging src/backend/nodes/nodeFuncs.c
Auto-merging src/backend/executor/execExprInterp.c
Auto-merging src/backend/executor/execExpr.c
Auto-merging doc/src/sgml/func/func-json.sgml
CONFLICT (content): Merge conflict in doc/src/sgml/func/func-json.sgml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add SQL/JSON ON MISMATCH clause to JSON_VALUE, JSON_QUERY, JSON_TABLE functions.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
=== using patch(1) to apply patch ./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch ===
patching file doc/src/sgml/func/func-json.sgml
Hunk #1 succeeded at 3409 (offset 141 lines).
Hunk #2 succeeded at 3457 (offset 141 lines).
Hunk #3 succeeded at 3480 (offset 141 lines).
Hunk #4 succeeded at 3504 (offset 141 lines).
Hunk #5 succeeded at 3519 (offset 141 lines).
Hunk #6 succeeded at 3550 (offset 141 lines).
Hunk #7 succeeded at 3584 (offset 141 lines).
Hunk #8 FAILED at 3534.
Hunk #9 FAILED at 3956.
2 out of 9 hunks FAILED -- saving rejects to file doc/src/sgml/func/func-json.sgml.rej
patching file src/backend/executor/execExpr.c
Hunk #1 succeeded at 4750 (offset 2 lines).
Hunk #2 succeeded at 4834 (offset 2 lines).
Hunk #3 succeeded at 4900 (offset 2 lines).
Hunk #4 succeeded at 5000 (offset 2 lines).
patching file src/backend/executor/execExprInterp.c
Hunk #1 succeeded at 4922 (offset 74 lines).
Hunk #2 succeeded at 5010 (offset 74 lines).
Hunk #3 succeeded at 5037 (offset 74 lines).
Hunk #4 succeeded at 5137 (offset 74 lines).
Hunk #5 succeeded at 5333 (offset 74 lines).
patching file src/backend/nodes/nodeFuncs.c
Hunk #1 succeeded at 3493 (offset 71 lines).
patching file src/backend/parser/gram.y
Hunk #1 succeeded at 800 with fuzz 2 (offset 46 lines).
Hunk #2 succeeded at 15250 (offset 701 lines).
Hunk #3 succeeded at 15271 (offset 701 lines).
Hunk #4 succeeded at 17218 (offset 801 lines).
Hunk #5 succeeded at 17253 (offset 801 lines).
Hunk #6 succeeded at 18055 (offset 803 lines).
Hunk #7 succeeded at 19084 (offset 1013 lines).
Hunk #8 succeeded at 19717 (offset 1025 lines).
patching file src/backend/parser/parse_expr.c
Hunk #1 succeeded at 4718 (offset 124 lines).
Hunk #2 succeeded at 4793 (offset 124 lines).
patching file src/backend/parser/parse_jsontable.c
Hunk #1 succeeded at 535 (offset 99 lines).
patching file src/backend/utils/adt/ruleutils.c
Hunk #1 succeeded at 9797 (offset 553 lines).
patching file src/include/nodes/execnodes.h
Hunk #1 succeeded at 1128 (offset 34 lines).
patching file src/include/nodes/parsenodes.h
Hunk #1 succeeded at 1960 (offset 74 lines).
Hunk #2 succeeded at 2071 (offset 117 lines).
patching file src/include/nodes/primnodes.h
Hunk #1 succeeded at 1861 (offset 1 line).
patching file src/include/parser/kwlist.h
Hunk #1 succeeded at 285 (offset 4 lines).
patching file src/test/regress/expected/sqljson_queryfuncs.out
Hunk #1 succeeded at 1557 (offset 29 lines).
patching file src/test/regress/sql/sqljson_queryfuncs.sql
Hunk #1 succeeded at 519 (offset 17 lines).
Unstaged changes after reset:
M doc/src/sgml/func/func-json.sgml
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/sql/sqljson_queryfuncs.sql
Removing doc/src/sgml/func/func-json.sgml.rej
=== using 'git apply' to apply patch ./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch ===
/work/patches/./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch:582: indent with spaces.
json_behavior ON EMPTY_P json_behavior ON MISMATCH json_behavior ON ERROR_P
/work/patches/./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch:583: indent with spaces.
{ $$ = list_make3($1, $4, $7); }
/work/patches/./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch:585: indent with spaces.
| json_behavior ON EMPTY_P json_behavior ON ERROR_P
/work/patches/./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch:586: indent with spaces.
{ $$ = list_make3($1, NULL, $4); }
/work/patches/./v2-0001-Add-SQL-JSON-ON-MISMATCH-clause-to-JSON_VALUE-JSO.patch:587: indent with spaces.
| json_behavior ON EMPTY_P json_behavior ON MISMATCH
Applied patch to 'doc/src/sgml/func/func-json.sgml' with conflicts.
Applied patch to 'src/backend/executor/execExpr.c' cleanly.
Applied patch to 'src/backend/executor/execExprInterp.c' cleanly.
Applied patch to 'src/backend/nodes/nodeFuncs.c' cleanly.
Applied patch to 'src/backend/parser/gram.y' cleanly.
Applied patch to 'src/backend/parser/parse_expr.c' cleanly.
Applied patch to 'src/backend/parser/parse_jsontable.c' cleanly.
Applied patch to 'src/backend/utils/adt/ruleutils.c' cleanly.
Applied patch to 'src/include/nodes/execnodes.h' cleanly.
Applied patch to 'src/include/nodes/parsenodes.h' cleanly.
Applied patch to 'src/include/nodes/primnodes.h' cleanly.
Applied patch to 'src/include/parser/kwlist.h' cleanly.
Applied patch to 'src/test/regress/expected/sqljson_queryfuncs.out' cleanly.
Applied patch to 'src/test/regress/sql/sqljson_queryfuncs.sql' cleanly.
U doc/src/sgml/func/func-json.sgml
warning: squelched 12 whitespace errors
warning: 17 lines add whitespace errors.
diff --cc doc/src/sgml/func/func-json.sgml
index 0763ec81ed8,6ebcd6ddf7a..00000000000
--- a/doc/src/sgml/func/func-json.sgml
+++ b/doc/src/sgml/func/func-json.sgml
@@@ -3658,43 -3534,29 +3675,69 @@@ DETAIL: Missing "]" after array dimens
The syntax is:
++<<<<<<< ours
+
+JSON_TABLE (
+ context_item, path_expression AS json_path_name PASSING { value AS varname } , ...
+ COLUMNS ( json_table_column , ... )
+
+ PLAN ( json_table_plan ) |
+ PLAN DEFAULT ( { OUTER | INNER } , { CROSS | UNION }
+ | { CROSS | UNION } , { OUTER | INNER } )
+
+ { ERROR | EMPTY ARRAY} ON ERROR
+)
+
+
+where json_table_column is:
+
+ name FOR ORDINALITY
+ | name type
+ FORMAT JSON ENCODING UTF8
+ PATH path_expression
+ { WITHOUT | WITH { CONDITIONAL | UNCONDITIONAL } } ARRAY WRAPPER
+ { KEEP | OMIT } QUOTES ON SCALAR STRING
+ { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT expression } ON EMPTY
+ { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT expression } ON ERROR
+ | name type EXISTS PATH path_expression
+ { ERROR | TRUE | FALSE | UNKNOWN } ON ERROR
+ | NESTED PATH path_expression AS json_path_name COLUMNS ( json_table_column , ... )
+
+json_table_plan is:
+
+ json_path_name { OUTER | INNER } json_table_plan_primary
+ | json_table_plan_primary { UNION json_table_plan_primary } ...
+ | json_table_plan_primary { CROSS json_table_plan_primary } ...
+
+json_table_plan_primary is:
+
+ json_path_name | ( json_table_plan )
+
++=======
+
+ JSON_TABLE (
+ context_item, path_expression AS json_path_name PASSING { value AS varname } , ...
+ COLUMNS ( json_table_column , ... )
+ { ERROR | EMPTY ARRAY} ON ERROR
+ )
+
+
+ where json_table_column is:
+
+ name FOR ORDINALITY
+ | name type
+ FORMAT JSON ENCODING UTF8
+ PATH path_expression
+ { WITHOUT | WITH { CONDITIONAL | UNCONDITIONAL } } ARRAY WRAPPER
+ { KEEP | OMIT } QUOTES ON SCALAR STRING
+ { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT expression } ON EMPTY
+ { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT expression } ON MISMATCH
+ { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT expression } ON ERROR
+ | name type EXISTS PATH path_expression
+ { ERROR | TRUE | FALSE | UNKNOWN } ON ERROR
+ | NESTED PATH path_expression AS json_path_name COLUMNS ( json_table_column , ... )
+
++>>>>>>> theirs
Each syntax element is described below in more detail.
@@@ -4218,41 -3957,33 +4261,69 @@@ COLUMNS
1 | | | | 2 | Wonder | 2 | Craig Doe
(5 rows)
-
++<<<<<<< ours
+
+ Find a director that has done films in two different genres:
+
+SELECT
+ director1 AS director, title1, kind1, title2, kind2
+FROM
+ my_films,
+ JSON_TABLE ( js, '$.favorites' AS favs COLUMNS (
+ NESTED PATH '$[*]' AS films1 COLUMNS (
+ kind1 text PATH '$.kind',
+ NESTED PATH '$.films[*]' AS film1 COLUMNS (
+ title1 text PATH '$.title',
+ director1 text PATH '$.director')
+ ),
+ NESTED PATH '$[*]' AS films2 COLUMNS (
+ kind2 text PATH '$.kind',
+ NESTED PATH '$.films[*]' AS film2 COLUMNS (
+ title2 text PATH '$.title',
+ director2 text PATH '$.director'
+ )
+ )
+ )
+ PLAN (favs OUTER ((films1 INNER film1) CROSS (films2 INNER film2)))
+ ) AS jt
+ WHERE kind1 > kind2 AND director1 = director2;
+
+ director | title1 | kind1 | title2 | kind2
+------------------+---------+----------+--------+--------
+ Alfred Hitchcock | Vertigo | thriller | Psycho | horror
+(1 row)
+
+
+
++=======
+
+ This example demonstrates the distinction between ON MISMATCH
+ and ON ERROR using the my_films table.
+ The first column triggers a mismatch because the "kind"
+ field exists (value is "comedy") but cannot be cast to an integer.
+ The second column triggers an error because the path is in strict
+ mode and the key "ratings" does not exist.
+
+
+
+ SELECT
+ json_query(js, '$.favorites[0].kind'
+ RETURNING int
+ DEFAULT -1 ON MISMATCH) AS kind_mismatch,
+ json_query(js, 'strict $.favorites[0].ratings'
+ RETURNING int
+ DEFAULT -2 ON ERROR) AS strict_error
+ FROM my_films;
+
+
+
+ kind_mismatch | strict_error
+ ---------------+--------------
+ -1 | -2
+ (1 row)
+
++>>>>>>> theirs