Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNvBg-0004Re-O7 for pgsql-bugs@arkaria.postgresql.org; Tue, 07 May 2019 08:10:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNvBf-0003AT-09 for pgsql-bugs@arkaria.postgresql.org; Tue, 07 May 2019 08:10:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNvBe-000395-Jq for pgsql-bugs@lists.postgresql.org; Tue, 07 May 2019 08:10:54 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNvBb-0004rX-Mo for pgsql-bugs@lists.postgresql.org; Tue, 07 May 2019 08:10:53 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x478Ake6009880; Tue, 7 May 2019 17:10:46 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 7F97F637CE2; Tue, 7 May 2019 17:10:46 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 73CAC637CD9; Tue, 7 May 2019 17:10:46 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 6BCFA40013D; Tue, 7 May 2019 17:10:46 +0900 (JST) Subject: Re: BUG #15672: PostgreSQL 11.1/11.2 crashed after dropping a partition table References: <20190426153921.GA22956@alvherre.pgsql> <9943.1556305069@sss.pgh.pa.us> From: Amit Langote Message-ID: <3cf270d8-40dc-ea8b-c7b7-4236af6ef972@lab.ntt.co.jp> Date: Tue, 7 May 2019 17:10:34 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <9943.1556305069@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Tom Lane , Alvaro Herrera Cc: Amit Langote , Michael Paquier , jianingy.yang@gmail.com, PostgreSQL mailing lists , Pg Hackers X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019/04/27 3:57, Tom Lane wrote: > Alvaro Herrera writes: >> Um, this one doesn't apply because of yesterday's 87259588d0ab. > > Before we spend too much time on minutiae, we should ask ourselves whether > this patch is even going in the right direction. I'm not sure. > > One point is that if we simply adopt the old index as-is, we won't see > any updates in its metadata. An example is that if we have an index > on a varchar(10) column, and we alter the column to varchar(12), > the current behavior is to generate a new index that agrees with that: > > regression=# create table pp(f1 varchar(10) unique); > CREATE TABLE > regression=# \d pp_f1_key > Index "public.pp_f1_key" > Column | Type | Key? | Definition > --------+-----------------------+------+------------ > f1 | character varying(10) | yes | f1 > unique, btree, for table "public.pp" > > regression=# alter table pp alter column f1 type varchar(12); > ALTER TABLE > regression=# \d pp_f1_key > Index "public.pp_f1_key" > Column | Type | Key? | Definition > --------+-----------------------+------+------------ > f1 | character varying(12) | yes | f1 > unique, btree, for table "public.pp" > > With this patch, I believe, the index column will still claim to be > varchar(10). You're right, that's what happens. > Is that OK? It might not actually break anything > right now, but at the very least it's likely to be confusing. > Also, it'd essentially render the declared types/typmods of index > columns untrustworthy, which seems like something that would come > back to bite us. That's definitely misleading. Still, I think it'd be nice if we didn't have to do full-blown DefineIndex() in this case if only to update the pg_attribute tuples of the index relation. Maybe we could update them directly in the ALTER COLUMN TYPE's code path? Thanks, Amit