pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #14900: MView not null constraint 3+ messages / 3 participants [nested] [flat]
* BUG #14900: MView not null constraint @ 2017-11-12 03:16 neil@postgrescompare.com 0 siblings, 1 reply; 3+ messages in thread From: neil@postgrescompare.com @ 2017-11-12 03:16 UTC (permalink / raw) To: pgsql-bugs; +Cc: neil@postgrescompare.com The following bug has been logged on the website: Bug reference: 14900 Logged by: Neil Anderson Email address: neil@postgrescompare.com PostgreSQL version: 10.1 Operating system: OSx Description: This is probably not a bug but I spotted a question on StackOverflow that I've been attempting to answer re: not null constraints and materialized views. (https://stackoverflow.com/questions/47242219/how-to-indicate-that-a-column-is-not-nullable-when-crea...) If it's not a bug should postgres support ALTER MATERIALIZED VIEW ALTER COLUMN column SET NOT NULL syntax? Thanks, Neil -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14900: MView not null constraint @ 2017-11-12 17:12 Tom Lane <tgl@sss.pgh.pa.us> parent: neil@postgrescompare.com 0 siblings, 1 reply; 3+ messages in thread From: Tom Lane @ 2017-11-12 17:12 UTC (permalink / raw) To: neil@postgrescompare.com; +Cc: pgsql-bugs 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14900: MView not null constraint @ 2017-11-13 17:10 Neil Anderson <neil@postgrescompare.com> parent: Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Neil Anderson @ 2017-11-13 17:10 UTC (permalink / raw) To: pgsql-bugs 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 Attachments:^ permalink raw reply [nested|flat] 3+ messages in threadneil.vcf (text/x-vcard, 163B) download
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
end of thread, other threads:[~2017-11-13 17:10 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-11-12 03:16 BUG #14900: MView not null constraint neil@postgrescompare.com 2017-11-12 17:12 ` Tom Lane <tgl@sss.pgh.pa.us> 2017-11-13 17:10 ` Neil Anderson <neil@postgrescompare.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox