Re: Bug in date arithmetic

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Bug in date arithmetic
Дата
Msg-id 407d949e0908241313t20b0e78ekeb524846850cbbef@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Bug in date arithmetic  (David Fetter <david@fetter.org>)
Ответы Re: Bug in date arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Bug in date arithmetic  (David Fetter <david@fetter.org>)
Re: Bug in date arithmetic  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-hackers
On Mon, Aug 24, 2009 at 8:27 PM, David Fetter<david@fetter.org> wrote:
> I'm thinking that the unknown literal here should just cause an error
> in the case of '+'.  Same with '-', for what it's worth.

That would make a lot of people very unhappy. They expect things like

select date + '1 year'

to just work.

The problem is that they would also like

select date - '1year'
and
select date - '2000-01-01'

to work.

I wonder if we could get around this by inventing a new type
date_or_interval which looks at the input and decides which it is
using fairly strict rules. date_sub would take that type and do the
appropriate operation based on what the constant had in it.

Of course we still want to be able to do date1 - date2 or
date1+intervalcolumn so we would need implicit casts from date and
interval to this new type. The question is whether we could arrange
things so this implicit cast doesn't cause ambiguity elsewhere.

--
greg
http://mit.edu/~gsstark/resume.pdf


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: hba load error and silent mode
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Feedback about Drupal SQL debugging