Re: To-Do item: skip table scan for adding column with provable check constraints

From: ilmari(at)ilmari(dot)org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=)
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: To-Do item: skip table scan for adding column with provable check constraints
Date: 2016-05-24 22:12:05
Message-ID: d8jshx7nm16.fsf@dalvik.ping.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> Right. If there were a DEFAULT on the new column that would of course
>> be different, and you can also do thinks like CHECK (a != b) here.
>> However, if the CHECK constraint does not reference any column other
>> than the newly-added one, and if the new column will have the same
>> value for every row either because there is no default or because the
>> default is a constant,
>
> ... and if the CHECK expression is immutable ...

Doesn't it have to be already? Otherwise a value accepted at one point
in time could suddenly violate the constraint later, even though it
never changed.

ilmari

--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2016-05-24 22:13:53 Re: Allow COPY to use parameters
Previous Message David G. Johnston 2016-05-24 22:00:28 Re: Speaking of breaking compatibility...standard_conforming_strings