Re: constraints evaluate 'now' immediately

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: rw(at)mindark(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: constraints evaluate 'now' immediately
Date: 2000-10-16 20:06:03
Message-ID: 27347.971726763@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)org writes:
> I would like a constraint stating that a column may not have a date in the future:
> CHECK(my_date <= 'now')
> but I think it stores the time of constraint creation.

Yes, because 'now' is evaluated when the constant is parsed. Try
CHECK(my_date <= now())
instead.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2000-10-16 21:36:37 Re: unique/references not honored when inheriting tables
Previous Message Eivind Kvedalen 2000-10-16 19:53:21 bug-report