Re: On using "date 'XXX' + interval 'XXX'" vs "date 'XXX'"

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: On using "date 'XXX' + interval 'XXX'" vs "date 'XXX'"
Дата
Msg-id 3CE922B2.B3AE8D95@fourpalms.org
обсуждение исходный текст
Ответ на On using "date 'XXX' + interval 'XXX'" vs "date 'XXX'"  (Jon Lapham <lapham@extracta.com.br>)
Список pgsql-general
> > Try coercing the sum result back to a date.
...
> PS: Is this optimizable?  (ie: have the coersion be implicit in
> situations like this).  It sure seems like it is a good candidate...

Not at the parser or optimizer level. You *could* have had hours,
minutes, or seconds in that interval value you specified, in which case
you would be truncating to get back to date. We'd need more
infrastructure to somehow know how to optimize something like that.

Or, we could split the INTERVAL type into the (ugh) bunch-o-types
envisioned by the SQL standard. YEAR, MONTH, YEAR TO MONTH, and DAY
intervals could be converted directly to dates rather than timestamps.
This would allow the optimizer to know what the output range would be,
whereas now the range info is just used for input and output (and is
usually a don't-care internally since the other fields are zeros).

                  - Thomas

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Referential Integrity.
Следующее
От: Patrick Welche
Дата:
Сообщение: Re: Row Locking