summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2022-06-10 04:05:08 +0000
committerPeter Eisentraut2022-06-10 04:05:08 +0000
commit21724558650a7387ffbc2b0da53d6314389419bb (patch)
treeb6f1c0d50c459aefc4ae02898573f63650961995
parent4a8a5dd7f59cd8dd9969cef1969cb5f7c5124eec (diff)
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 <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/9d75ce67-0121-5050-5bec-bf5009db55ce%40enterprisedb.com
-rw-r--r--src/backend/parser/parse_jsontable.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/backend/parser/parse_jsontable.c b/src/backend/parser/parse_jsontable.c
index dbd3e66205..ae559d9cae 100644
--- a/src/backend/parser/parse_jsontable.c
+++ b/src/backend/parser/parse_jsontable.c
@@ -514,10 +514,7 @@ appendJsonTableColumns(JsonTableContext *cxt, List *columns)
tf->coltypes = lappend_oid(tf->coltypes, typid);
tf->coltypmods = lappend_int(tf->coltypmods, typmod);
- tf->colcollations = lappend_oid(tf->colcollations,
- type_is_collatable(typid)
- ? DEFAULT_COLLATION_OID
- : InvalidOid);
+ tf->colcollations = lappend_oid(tf->colcollations, get_typcollation(typid));
tf->colvalexprs = lappend(tf->colvalexprs, colexpr);
}
}