Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEIHZ-0005Ur-Mk for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Nov 2017 17:12:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEIHZ-0006Ef-8A for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Nov 2017 17:12:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eEIFs-0001Xt-QW for pgsql-bugs@lists.postgresql.org; Mon, 13 Nov 2017 17:10:40 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eEIFq-0006SL-4f for pgsql-bugs@postgresql.org; Mon, 13 Nov 2017 17:10:40 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eEIFe-0004f8-0k for pgsql-bugs@postgresql.org; Mon, 13 Nov 2017 18:10:26 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-bugs@postgresql.org From: Neil Anderson Subject: Re: BUG #14900: MView not null constraint Date: Mon, 13 Nov 2017 12:10:26 -0500 Organization: Postgres Compare Lines: 56 Message-ID: <91e087fe-0a09-722a-97b5-919baf524b3c@postgrescompare.com> References: <20171112031621.31521.10140@wrigleys.postgresql.org> <1980.1510506753@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------75877562912CF05055ABA33F" X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <1980.1510506753@sss.pgh.pa.us> X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------75877562912CF05055ABA33F Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 2017-11-12 12:12 PM, Tom Lane wrote: > neil@postgrescompare.com writes: >> This is probably not a bug > > Nope, it isn't. > >> If it's not a bug should postgres support >> ALTER MATERIALIZED VIEW ALTER COLUMN column SET NOT NULL syntax? > > Doesn't seem like a great idea to me. What's supposed to happen > if a view update would result in a violation of the constraint? > It's way too late to undo whatever change of the underlying data > caused that, so it seems like the only possible answer is for > REFRESHes to fail, resulting in the view getting more and more > out of date until and unless something manual is done to resolve > the problem. I can't see that that's a useful behavior to have. > > regards, tom lane > > Makes sense. Seems like the scaffolding tool's problem and in fact they do have a way to declare it non-nullable via comments now https://github.com/gajus/postloader#handling-non-nullable-columns-in-materialized-views Thanks for the info! -- Neil Anderson neil@postgrescompare.com http://www.postgrescompare.com --------------75877562912CF05055ABA33F Content-Type: text/x-vcard; charset=utf-8; name="neil.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="neil.vcf" begin:vcard fn:Neil Anderson n:Anderson;Neil email;internet:neil@postgrescompare.com x-mozilla-html:FALSE url:https://www.postgrescompare.com version:2.1 end:vcard --------------75877562912CF05055ABA33F--