Re: Open issues for collations

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Open issues for collations
Дата
Msg-id AANLkTim7iaxa1kN7t3PVmHZEnvt33KavYPDa+O7NbZK2@mail.gmail.com
обсуждение исходный текст
Ответ на Open issues for collations  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, Mar 26, 2011 at 4:36 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> ** Selecting a field from a record-returning function's output.
> Currently, we'll use the field's declared collation; except that
> if the field has default collation, we'll replace that with the common
> collation of the function's inputs, if any.  Is either part of that
> sane?  Do we need to make this work for functions invoked with other
> syntax than a plain function call, eg operator or cast syntax?

Either of those sounds reasonable but the combination seems weird.
Some example functions might help:

list_words('foo bar bar') -> ('foo'), ('bar'), ('baz')
fetch_users_by_lastname('Smith') -> (1,'John','Smith','Great
Britain','GB'), (2,'Jürgen','Smith','DE')
fetch_users_by_countrycode('DE') -> (2,'Jürgen','Smith','DE')

The first looks like it should definitely inherit. The second the
result set is heterogeneous and inheriting might be the best
compromise but it would produce very strange results for columns like
the country-code which should just use their defined collation of C.
The third case inheriting the country code's collation of C would be
very strange and definitely wrong.

It occurs to me that if we have any inherited cases people might come
to depend on that behaviour and there would be no out for us. Whereas
if we say record return values always use the record type's field's
collations then we could always later add a collation of type
_inherited or _anycollation or some such that indicated that that
column should inherit the arguments' collation and it wouldn't affect
any existing code.



--
greg


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vaibhav Kaushal
Дата:
Сообщение: Re: When and how many times does ExecSetParamPlan executes?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Open issues for collations