Re: Regarding select distinct ...query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Regarding select distinct ...query
Дата
Msg-id 12885.1040254044@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Regarding select distinct ...query  (Greg Stark <gsstark@mit.edu>)
Ответы Re: Regarding select distinct ...query  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
Greg Stark <gsstark@mit.edu> writes:
> I ran into precisely the same issue here yesterday. This works perfectly fine
> in Oracle, does the standard really leave "select distinct 'foo'" undefined?

The standard has no notion of datatype extensibility, so it's got no
problem with legislating that anything between single quotes is of type
CHAR(n).  If we followed the spec closely on this point, you'd probably
need an explicit cast for *every* literal you wanted to be of a datatype
other than numeric (no quotes) or string (with quotes).

We do have some kluges in place to default to assuming that
string-looking literals are of type TEXT when we can't figure out
anything else, but those kluges didn't cover the SELECT DISTINCT 'foo'
case last time I looked.  It's a fairly dangerous default assumption
IMHO, so I think it's appropriate to make it only in very narrowly
defined cases ...

            regards, tom lane

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

Предыдущее
От: Simon Mitchell
Дата:
Сообщение: Re: ORDER BY random() LIMIT 1 slowness
Следующее
От: Benjamin Scherrey
Дата:
Сообщение: Re: trouble caused by change in 7.3 handling of '' in