Skip to content

Commit 2172455

Browse files
committed
Fix collation of JSON_TABLE output columns
The output columns of JSON_TABLE should have the collations of their data type. The existing implementation sets the default collation if the type is collatable. Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Discussion: https://www.postgresql.org/message-id/flat/9d75ce67-0121-5050-5bec-bf5009db55ce%40enterprisedb.com
1 parent 4a8a5dd commit 2172455

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/backend/parser/parse_jsontable.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,7 @@ appendJsonTableColumns(JsonTableContext *cxt, List *columns)
514514

515515
tf->coltypes = lappend_oid(tf->coltypes, typid);
516516
tf->coltypmods = lappend_int(tf->coltypmods, typmod);
517-
tf->colcollations = lappend_oid(tf->colcollations,
518-
type_is_collatable(typid)
519-
? DEFAULT_COLLATION_OID
520-
: InvalidOid);
517+
tf->colcollations = lappend_oid(tf->colcollations, get_typcollation(typid));
521518
tf->colvalexprs = lappend(tf->colvalexprs, colexpr);
522519
}
523520
}

0 commit comments

Comments
 (0)