Re: Inconsistent values for 'now'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Glen Eustace <geustace(at)godzone(dot)net(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Inconsistent values for 'now'
Date: 2005-04-01 04:40:49
Message-ID: 2955.1112330449@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Glen Eustace <geustace(at)godzone(dot)net(dot)nz> writes:
> The view is defined to be;

> CREATE VIEW domain_registry AS
> SELECT *
> FROM domain_registry_history
> WHERE tstamp > 'now';

Offhand I'd expect the 'now' to be reduced to a timestamp constant
at the time the view is created.

Perhaps you were expecting something like

CREATE VIEW domain_registry AS
SELECT *
FROM domain_registry_history
WHERE tstamp > now();

although personally I'd not feel very comfortable with the idea of a
view whose contents change over time even when you weren't actually
doing anything to the database. Maybe you should rethink this idea
altogether...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Glen Eustace 2005-04-01 05:07:50 Re: Inconsistent values for 'now'
Previous Message Zitan Broth 2005-04-01 03:22:58 SELECT INTO Array?