Skip site navigation (1) Skip section navigation (2)

Re: Constant propagation and similar issues

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Jules Bean <jules(at)jellybean(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Constant propagation and similar issues
Date: 2000-09-17 18:46:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)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 like
	2000-01-01 11:33:05-04
	2000-09-17 14:39:44-04
	2000-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

In response to


pgsql-hackers by date

Next:From: Oleg BartunovDate: 2000-09-17 18:56:09
Subject: Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
Previous:From: Tom LaneDate: 2000-09-17 18:18:54
Subject: Re: ascii to character conversion in postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group