From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: jianingy.yang@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: BUG #15672: PostgreSQL 11.1/11.2 crashed after dropping a partition table
Date: Tue, 23 Apr 2019 18:03:05 -0400
Message-ID: <695.1556056985@sss.pgh.pa.us> (raw)
In-Reply-To: <d51e28a8-a725-b7ef-a6cf-8186e775b852@lab.ntt.co.jp>
References: <15672-b9fa7db32698269f@postgresql.org>
<20190307000316.GB17293@paquier.xyz>
<ea06533c-8514-1ec7-112a-2581f03bc070@lab.ntt.co.jp>
<CA+HiwqHtGpjSB8KUQdn_Hv3_DfjPqVrnMd5juVQRTDQRak2-Vg@mail.gmail.com>
<e39595de-f5b7-aa84-4528-73a5307f7997@lab.ntt.co.jp>
<d51e28a8-a725-b7ef-a6cf-8186e775b852@lab.ntt.co.jp>
ISTM we could work around the problem with the attached, which I think
is a good change independently of anything else.
There is still an issue, which manifests in both 11 and HEAD, namely
that the code also propagates the parent index's comment to any child
indexes. You can see that with this extended test case:
create table users(user_id int, name varchar(64), unique (user_id, name)) partition by hash(user_id);
comment on index users_user_id_name_key is 'parent index';
create table users_000 partition of users for values with (modulus 2, remainder 0);
create table users_001 partition of users for values with (modulus 2, remainder 1);
select relname, relfilenode, obj_description(oid,'pg_class') from pg_class where relname like 'users%';
alter table users alter column name type varchar(127);
select relname, relfilenode, obj_description(oid,'pg_class') from pg_class where relname like 'users%';
which gives me (in 11, with this patch)
...
relname | relfilenode | obj_description
----------------------------+-------------+-----------------
users | 89389 |
users_000 | 89394 |
users_000_user_id_name_key | 89397 |
users_001 | 89399 |
users_001_user_id_name_key | 89402 |
users_user_id_name_key | 89392 | parent index
(6 rows)
ALTER TABLE
relname | relfilenode | obj_description
----------------------------+-------------+-----------------
users | 89389 |
users_000 | 89394 |
users_000_user_id_name_key | 89406 | parent index
users_001 | 89399 |
users_001_user_id_name_key | 89408 | parent index
users_user_id_name_key | 89404 | parent index
(6 rows)
However, I doubt that that's bad enough to justify a major rewrite
of the ALTER TABLE code in 11 ... and maybe not in HEAD either;
I wouldn't be too unhappy to leave it to v13.
regards, tom lane
Attachments:
[text/x-diff] dont-try-to-share-storage-thats-not-there.patch (849B, ../695.1556056985@sss.pgh.pa.us/2-dont-try-to-share-storage-thats-not-there.patch)
download | inline diff:diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.cindex f8ee4b0..c5c543f 100644--- a/src/backend/commands/indexcmds.c+++ b/src/backend/commands/indexcmds.c@@ -252,8 +252,17 @@ CheckIndexCompatible(Oid oldId,
if (!ret)
return false;
- /* For polymorphic opcintype, column type changes break compatibility. */+ /* We now need to actually look at the index rel. */
irel = index_open(oldId, AccessShareLock); /* caller probably has a lock */
++ /* If it's a partitioned index, there is no storage to share. */+ if (irel->rd_rel->relkind == RELKIND_PARTITIONED_INDEX)+ {+ index_close(irel, NoLock);+ return false;+ }++ /* For polymorphic opcintype, column type changes break compatibility. */
for (i = 0; i < old_natts; i++)
{
if (IsPolymorphicType(get_opclass_input_type(classObjectId[i])) &&
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, Langote_Amit_f8@lab.ntt.co.jp, amitlangote09@gmail.com, michael@paquier.xyz, pgsql-bugs@lists.postgresql.org, pgsql-hackers@postgresql.org
Subject: Re: BUG #15672: PostgreSQL 11.1/11.2 crashed after dropping a partition table
In-Reply-To: <695.1556056985@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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