Re: Minor inheritance/check bug: Inconsistent behavior

From: Chris Travers <chris(at)metatrontech(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Minor inheritance/check bug: Inconsistent behavior
Date: 2012-08-28 06:46:13
Message-ID: CAPKNUtegmYU3bSx+Qr+cg6-xpTpD9UooZtOXWCDfR7XS5oD3LQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Aug 27, 2012 at 1:34 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Robert Haas <robertmhaas(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2012-08-28 10:40:07 Re: Minor inheritance/check bug: Inconsistent behavior
Previous Message Bruce Momjian 2012-08-28 02:40:53 Re: BUG #6489: Alter table with composite type/table