Re: Constant propagation and similar issues

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Constant propagation and similar issues
Дата
Msg-id 6909.969216395@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Constant propagation and similar issues  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Список pgsql-hackers
Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
>> AFAIK hardly anyone actually uses CURRENT, and I've been thinking of
>> proposing that we eliminate it to make the world safe for constant-
>> folding timestamp operations.  (Thomas, any comments here?)

> Well, it is a feature from "the old days". Pretty neat one at that, and
> is an example of a useful feature not found in other DBs or in
> standards, but which might show up someday because they are useful.

I'm not convinced that it is useful.  What I think it is is a good way
of shooting yourself in the foot, because it's so hard to control when
'CURRENT' will be reduced to a specific time value.

I have no problem with the datetime input converters accepting the input
string 'CURRENT' and immediately replacing it with the current time.
That behavior is clearly useful and creates no semantic issues.  But
I don't think that a special data value that symbolically represents
current time is either useful or well-defined.

Just to give one example of why the concept is broken: consider an index
on a timestamp column that contains some CURRENT values.  Today the
index might look like2000-01-01 11:33:05-042000-09-17 14:39:44-04CURRENT2000-09-18 14:11:07-04
which is fine.  But twenty-four hours from now, this index will be out
of order and hence broken.  (The btree routines do not cope at all
gracefully with logically-inconsistent indexes.)

So I still recommend that we remove the special value CURRENT.  Then we
can mark the datetime-related operators constant-foldable, which will
eliminate a complaint that we can otherwise expect to hear constantly
(saw another instance today in pgsql-sql).
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ascii to character conversion in postgres
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?