pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dmitry Molotkov <aldarund@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15446: Crash on ALTER TABLE
Date: Sun, 6 Jan 2019 17:40:16 -0500
Message-ID: <f66296a1-2b66-e392-0ba0-64175d0846ec@2ndQuadrant.com> (raw)
In-Reply-To: <20190105170940.2qrbilpxmmxyf4tr@alap3.anarazel.de>
References: <CADfhRDKYosWqKg8OV8HwG2iMhbPYJxqPVesOM_cdE=ESKxKi4g@mail.gmail.com>
	<20181027144557.6uil4sqrvor25m3x@alvherre.pgsql>
	<CADfhRDJHkTFeO8TxesK1Ysrg+48XW1Kd+FULQd5+6Dd=Sj8J2w@mail.gmail.com>
	<CADfhRDLaB4T-oGJujgpcDb05Q3cs0cuUws7UWGqkxR761T5Tpw@mail.gmail.com>
	<20190104211700.jloztzladojvpxij@alap3.anarazel.de>
	<CADfhRDJ6XPaJtF8D4X5P3TB_67xXKp4dxgNJ=Kwd63MwLsSYUg@mail.gmail.com>
	<20190104222542.5zcrjv5p24ssw7te@alap3.anarazel.de>
	<CADfhRDJ5_zgWy5soYZ-O-Ees6bs9DgDDwbvFjrwK7r3g1Xc9sA@mail.gmail.com>
	<14358.1546648708@sss.pgh.pa.us>
	<CAEZATCXVPUu+hV1n_-V8Q2-TVtof=kzpdAv01VJmzGmTwsQ9NA@mail.gmail.com>
	<20190105170940.2qrbilpxmmxyf4tr@alap3.anarazel.de>


On 1/5/19 12:09 PM, Andres Freund wrote:
> Hi,
>
> On 2019-01-05 12:11:45 +0000, Dean Rasheed wrote:
>> It looks like the problem was introduced in PG11 by 16828d5c02 (Fast
>> ALTER TABLE ADD COLUMN with a non-NULL default). The first ALTER TABLE
>> adds a new column with a non-null default, setting atthasmissing and
>> attmissingval. Then the second ALTER TABLE changes the type of the new
>> column, but it fails to update attmissingval to match, and thus it
>> falls over when trying to re-open the relation because the value in
>> attmissingval is no longer compatible with the attribute type.
> Paging Dr Dunstan.



Investigating with this test case:


    DROP TABLE IF EXISTS foo;
    CREATE TABLE foo (a int);
    ALTER TABLE foo ADD COLUMN b double precision DEFAULT 0.2;
    ALTER TABLE foo ALTER COLUMN b TYPE varchar(5) USING b::varchar(5);


cheers


andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (23+ messages)  latest in thread

Message-ID: <f66296a1-2b66-e392-0ba0-64175d0846ec@2ndQuadrant.com>
Permalink:  ../f66296a1-2b66-e392-0ba0-64175d0846ec@2ndQuadrant.com/
Also on:    postgresql.org/message-id/f66296a1-2b66-e392-0ba0-64175d0846ec@2ndQuadrant.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andrew.dunstan@2ndquadrant.com, andres@anarazel.de, dean.a.rasheed@gmail.com, tgl@sss.pgh.pa.us, aldarund@gmail.com, alvherre@2ndquadrant.com
  Subject: Re: BUG #15446: Crash on ALTER TABLE
  In-Reply-To: <f66296a1-2b66-e392-0ba0-64175d0846ec@2ndQuadrant.com>
  References: <CADfhRDKYosWqKg8OV8HwG2iMhbPYJxqPVesOM_cdE=ESKxKi4g@mail.gmail.com> <20181027144557.6uil4sqrvor25m3x@alvherre.pgsql> <CADfhRDJHkTFeO8TxesK1Ysrg+48XW1Kd+FULQd5+6Dd=Sj8J2w@mail.gmail.com> <CADfhRDLaB4T-oGJujgpcDb05Q3cs0cuUws7UWGqkxR761T5Tpw@mail.gmail.com> <20190104211700.jloztzladojvpxij@alap3.anarazel.de> <CADfhRDJ6XPaJtF8D4X5P3TB_67xXKp4dxgNJ=Kwd63MwLsSYUg@mail.gmail.com> <20190104222542.5zcrjv5p24ssw7te@alap3.anarazel.de> <CADfhRDJ5_zgWy5soYZ-O-Ees6bs9DgDDwbvFjrwK7r3g1Xc9sA@mail.gmail.com> <14358.1546648708@sss.pgh.pa.us> <CAEZATCXVPUu+hV1n_-V8Q2-TVtof=kzpdAv01VJmzGmTwsQ9NA@mail.gmail.com> <20190105170940.2qrbilpxmmxyf4tr@alap3.anarazel.de> <f66296a1-2b66-e392-0ba0-64175d0846ec@2ndQuadrant.com>

* 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