Re: pg_upgrade failed with error - ERROR: column "a" in child table must be marked NOT NULL
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: tushar <tushar.ahuja@enterprisedb.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-07-27T14:58:46Z
Lists: pgsql-hackers
Attachments
- alttab-setnotnull-v1.patch (application/octet-stream) patch v1
On Wed, Jul 26, 2017 at 4:50 PM, Michael Paquier <michael.paquier@gmail.com> wrote: > On Wed, Jul 26, 2017 at 4:02 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> Not sure what's involved there code-wise, though, nor whether we'd want >> to back-patch. > > I'll try to look at the code around that to come up with a clear > conclusion in the next couple of days, likely more as that's a > vacation period. Surely anything invasive would not be backpatched. So I think that the attached patch is able to do the legwork. While looking at the code, I have bumped into index_check_primary_key() that discarded the case of sending SET NOT NULL to child tables, as introduced by 88452d5b. But that's clearly an oversight IMO, and the comment is wrong to begin with because SET NOT NULL is spread to child tables. Using is_alter_table instead of a plain true in index_check_primary_key() for the call of AlterTableInternal() is defensive, but I don't think that we want to impact any modules relying on this API, so recursing only when ALTER TABLE is used is the safest course of action to me. With this logic, we rely as well on the fact that ADD PRIMARY KEY is not recursive in tablecmds.c. Comments are welcome, I'll park that into the CF app so as it does not get lost in the void. -- Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix new pg_upgrade query not to rely on regnamespace
- f943e2339f6c 16.10 landed
- bd48455d88a8 15.14 landed
- bcb8d47cdd5e 17.6 landed
- 94dc2b37baee 14.19 landed
- 708469281ea8 13.22 landed
- 1e007722fa86 18.0 landed
- 144ad723a448 19 (unreleased) landed
-
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance
- f63e408e894c 16.10 landed
- f295494d338c 19 (unreleased) landed
- ea3386cc784a 14.19 landed
- b8b2e60527c6 17.6 landed
- b0f0e2221f42 13.22 landed
- 0f49586850a9 15.14 landed
- 07da2985d6bf 18.0 landed
-
Apply ALTER ... SET NOT NULL recursively in ALTER ... ADD PRIMARY KEY.
- c30f1770a93d 10.0 landed