Re: [BUGS] pg_dump and pg_restore on inherited tables problem
От | Michael Paquier |
---|---|
Тема | Re: [BUGS] pg_dump and pg_restore on inherited tables problem |
Дата | |
Msg-id | CAB7nPqRU-BaEt_Gh=Hf5nkUy4UHshoBOZU4NR6NpGgVP+Cx1qw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [BUGS] pg_dump and pg_restore on inherited tables problem (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
On Tue, Sep 5, 2017 at 12:24 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > We've fixed that problem in v10: now, the child table inherits the > not-null constraint when you do the ALTER ADD PRIMARY KEY. Here is the result commit, with a reference to the thread: commit: c30f1770a93db1492755934048656ea809c1f569 author: Tom Lane <tgl@sss.pgh.pa.us> date: Fri, 4 Aug 2017 11:45:18 -0400 Apply ALTER ... SET NOT NULL recursively in ALTER ... ADD PRIMARY KEY. If you do ALTER COLUMN SET NOT NULL against an inheritance parent table, it will recurse to mark all the child columns as NOT NULL as well. This is necessary for consistency: if the column is labeled NOT NULL then reading it should never produce nulls. However, that didn't happen in the case where ALTER ... ADD PRIMARY KEY marks a target column NOT NULL that wasn't before. That was questionable from the beginning, and now Tushar Ahuja points out that it can lead to dump/restore failures in some cases. So let's make that case recurse too. Although this is meant to fix a bug, it's enough of a behavioral change that I'm pretty hesitant to back-patch, especially in view of the lack of similar field complaints. It doesn't seem to be too late to put it into v10 though. Michael Paquier, editorialized on slightly by me Discussion: https://postgr.es/m/b8794d6a-38f0-9d7c-ad4b-e85adf860fc9@enterprisedb.com -- Michael -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
В списке pgsql-bugs по дате отправления: