Re: using index or check in ALTER TABLE SET NOT NULL

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Sergei Kornilov <sk(at)zsrv(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: using index or check in ALTER TABLE SET NOT NULL
Date: 2018-04-06 03:29:32
Message-ID: b74455c1-f89e-02e3-471a-8fdd9275fab9@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/29/17 10:52, Sergei Kornilov wrote:
> My target problem of adding NOT NULL to big relation without long downtime can be done with ADD CONSTRAINT NOT VALID, VALIDATE it in second transaction, then SET NOT NULL by my patch and drop unneeded constraint.

It seems to me that this is a workaround for not properly cataloguing
NOT NULL constraints. If we fixed that, you could do SET NOT NULL NOT
VALID and go from there. Maybe we should look again into fixing that.
That would solve so many problems.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-04-06 03:41:53 Re: WIP: a way forward on bootstrap data
Previous Message David Rowley 2018-04-06 03:27:16 Re: [HACKERS] Runtime Partition Pruning