Re: BUG #6612: Functions can be called inside CHECK statements - Mailing list pgsql-bugs

From Greg Stark
Subject Re: BUG #6612: Functions can be called inside CHECK statements
Date
Msg-id CAM-w4HPq43NnPSE+7H1GwCZGzxCmd3Kwj_RzFZDn3UQsveHxow@mail.gmail.com
Whole thread Raw
In response to Re: BUG #6612: Functions can be called inside CHECK statements  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: BUG #6612: Functions can be called inside CHECK statements  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, Apr 25, 2012 at 4:06 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> A CHECK constraint using a volatile function is potentially valid
> and useful, IMO. =A0Think about a column which is supposed to record
> the moment of an event which has occurred. =A0It could make sense to
> ensure that the timestamptz value is < now(); =A0On the other hand, an
> index entry based on now() is clearly a problem.
>
> Otherwise I agree with your response -- this is clearly *not* a bug.

Hm. I suppose it depends on what you think a constraint is. I had
always thought it was a guarantee that all the data in the table would
meet that constraint. Not just a procedural definition for something
to do at certain points in time.

But I guess I responded based on my understanding without checking
whether it was right. sorry.

Hm, but this does raise the question of whether they're the right
thing to be basing the partitioning constraint exclusion code on. I'll
speculate without checking again that we check the immutability of the
constraint before using it in constraint exclusion but that seems a
ad-hoc.


--=20
greg

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #6612: Functions can be called inside CHECK statements
Next
From: Tom Lane
Date:
Subject: Re: BUG #6612: Functions can be called inside CHECK statements