mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Per-column collation support
This adds collation support for columns and domains, a COLLATE clause to override it per expression, and B-tree index support. Peter Eisentraut reviewed by Pavel Stehule, Itagaki Takahiro, Robert Haas, Noah Misch
This commit is contained in:
@ -613,7 +613,8 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
|
||||
|
||||
tupdesc = BuildDescFromLists(rte->eref->colnames,
|
||||
rte->funccoltypes,
|
||||
rte->funccoltypmods);
|
||||
rte->funccoltypmods,
|
||||
rte->funccolcollations);
|
||||
CheckAttributeNamesTypes(tupdesc, RELKIND_COMPOSITE_TYPE, false);
|
||||
}
|
||||
|
||||
@ -1935,6 +1936,7 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
|
||||
bool resolveUnknown)
|
||||
{
|
||||
Oid restype = exprType((Node *) tle->expr);
|
||||
Oid rescollation = exprCollation((Node *) tle->expr);
|
||||
Oid sortop;
|
||||
Oid eqop;
|
||||
bool hashable;
|
||||
@ -2018,6 +2020,12 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
|
||||
break;
|
||||
}
|
||||
|
||||
if (type_is_collatable(restype) && !OidIsValid(rescollation))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDETERMINATE_COLLATION),
|
||||
errmsg("no collation was derived for the sort expression"),
|
||||
errhint("Use the COLLATE clause to set the collation explicitly.")));
|
||||
|
||||
cancel_parser_errposition_callback(&pcbstate);
|
||||
|
||||
/* avoid making duplicate sortlist entries */
|
||||
|
Reference in New Issue
Block a user