Re: Minor inheritance/check bug: Inconsistent behavior - Mailing list pgsql-bugs

From Chris Travers
Subject Re: Minor inheritance/check bug: Inconsistent behavior
Date
Msg-id CAPKNUtegmYU3bSx+Qr+cg6-xpTpD9UooZtOXWCDfR7XS5oD3LQ@mail.gmail.com
Whole thread Raw
In response to Re: Minor inheritance/check bug: Inconsistent behavior  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Mon, Aug 27, 2012 at 1:34 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Robert Haas <robertmhaas@gmail.com> writes:
> > Maybe, but in that case shouldn't referencing a system column chuck an
> error?
>
> Yeah, possibly.  I think none of them are populated with anything useful
> during INSERT checks (though OID might be an exception?).  Less sure
> about the state during UPDATE checks, though.
>
> My vote honestly would be to make it be an error.  A check constraint
which fails only after it has been saved and then updated strikes me as
behavior outside the role of a check constraint and dangerously so.  It
doesn't work as advertised, and people will find this out only after their
data is shown not to be consistent with the check constraint.

This being said, again, my sense is that no inherit check constraints will
make it quite unlikely that this will ever affect production servers.  So
failing this it's sufficient I think in future versions (maybe 9.3 forward)
to add a paragraph to the docs.  Something like:

Warning:  The behavior of a check constraint operating against a system
column is undefined. Check constraints are not intended to be used this way
and behavior may change without notice.

Maybe worth bringing up on the docs list.  I don't mind the fact that
behavior is undefined in some cases.  However, it might be a good idea to
let people know that they are moving into "we won't commit not to breaking
your app even if you get this to work" territory.

Best Wishes,
Chris Travers

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #6489: Alter table with composite type/table
Next
From: Amit Kapila
Date:
Subject: Re: Minor inheritance/check bug: Inconsistent behavior