Re: AT TIME ZONE INTERVAL and prepared statements

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: AT TIME ZONE INTERVAL and prepared statements
Дата
Msg-id 20003.1098486127@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: AT TIME ZONE INTERVAL and prepared statements  (Kris Jurka <books@ejurka.com>)
Список pgsql-bugs
Kris Jurka <books@ejurka.com> writes:
> On Fri, 22 Oct 2004, Tom Lane wrote:
>> You are confusing the syntax for a typed literal with part of the AT
>> TIME ZONE construct.

> Could you explain what the difference is between a typed literal
> "int '11'" and a cast(ed) literal "'11'::int" to me they seem like the
> same thing.

Yes, they are semantically the same.  The first one is a kluge that Tom
Lockhart put in to approximate the SQL spec's demands for representation
of timestamp and interval constants.  It does not work syntactically to
try to extend it to a general cast construct (we can only barely manage
to support it as-is --- there are various special cases that don't work
such as arrays and qualified type names, and a depressingly large part
of gram.y is devoted to getting the cases that do work to work).  Even
if we could get the parser to cope with that without reduce/reduce
errors, we'd be greatly reducing the grammar's ability to detect actual
syntax errors, because practically anything next to practically anything
else would become a potentially legal cast construct.

So, no "INTERVAL $1".  Bad enough we have to take "INTERVAL 'string'".
This wasn't one of the SQL committee's better ideas.

            regards, tom lane

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: AT TIME ZONE INTERVAL and prepared statements
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problem with rule and null value