Re: BUG #13805: plpgsql execute using expression evaluate wrong

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #13805: plpgsql execute using expression evaluate wrong
Дата
Msg-id 14234.1449556599@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #13805: plpgsql execute using expression evaluate wrong  (David Gould <daveg@sonic.net>)
Ответы Re: BUG #13805: plpgsql execute using expression evaluate wrong  (David Gould <daveg@sonic.net>)
Re: BUG #13805: plpgsql execute using expression evaluate wrong  (Terje Elde <terje@elde.net>)
Список pgsql-bugs
David Gould <daveg@sonic.net> writes:
> However, it does seem a little odd that the literal syntax for
> intervals accepts the '$':
> ...
> I would have expected it to raise an error. The documentation does not shed
> any light on this. Anyone?

The datetime input parser tends to consider most non-alphanumeric
characters as being insignificant except as field separators.  We could
tighten that up, but I think we should tread pretty carefully for fear of
breaking cases that used to work.  A trivial example:

regression=# select '1 mon 1 day'::interval;
  interval
-------------
 1 mon 1 day
(1 row)

regression=# select '1 mon, 1 day'::interval;
  interval
-------------
 1 mon 1 day
(1 row)

If we started to reject the second case, we'd likely get complaints.
But the parser doesn't see that as any different from

regression=# select '1 mon$ 1 day'::interval;
  interval
-------------
 1 mon 1 day
(1 row)

Trying to decide which characters are legitimate noise and which
aren't seems like a tarbaby best not to get stuck to :-(

            regards, tom lane

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

Предыдущее
От: Jov
Дата:
Сообщение: Re: BUG #13805: plpgsql execute using expression evaluate wrong
Следующее
От: David Gould
Дата:
Сообщение: Re: BUG #13805: plpgsql execute using expression evaluate wrong