Re: date bug

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: date bug
Дата
Msg-id 28774.990053980@sss.pgh.pa.us
обсуждение исходный текст
Ответ на date bug  ("Jeff Patterson" <jpat@mywayhealth.com>)
Список pgsql-bugs
"Jeff Patterson" <jpat@mywayhealth.com> writes:
> Strange date behavior as shown below.

This is not a date bug; it's your misunderstanding of how SQL functions
work.  A function that returns a scalar can only return one result, so
it makes no sense to try to define its result as a SELECT from a
multi-row table.

As it happens, what you get is the result from the first row returned
by the SELECT.  (Personally I'd have thought it'd make more sense to
raise an error if the SELECT returns multiple rows, but we'd probably
break existing applications if we changed it.)

Perhaps you want something on the order of

    SELECT EXISTS(SELECT 1 FROM holidays WHERE date = $1)

            regards, tom lane

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

Предыдущее
От: "Jonathan Ellis"
Дата:
Сообщение: Re: orphaned trigger
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: orphaned trigger