pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dmitry Molotkov <aldarund@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: BUG #15446: Crash on ALTER TABLE
Date: Tue, 8 Jan 2019 19:41:55 -0500
Message-ID: <9e4caaa2-e2af-fd7f-e864-ae67e9560579@2ndQuadrant.com> (raw)
In-Reply-To: <CAEZATCVs=0qAggyb7MGtab_OQ6LWiGW8gx00wQuu=ZqqVwASrQ@mail.gmail.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>
	<1f382801-d55c-bc0b-b632-0731867091e4@2ndQuadrant.com>
	<CAEZATCVs=0qAggyb7MGtab_OQ6LWiGW8gx00wQuu=ZqqVwASrQ@mail.gmail.com>


On 1/8/19 4:48 PM, Dean Rasheed wrote:
> On Tue, 8 Jan 2019 at 19:34, Andrew Dunstan
> <andrew.dunstan@2ndquadrant.com> wrote:
>> Here's a patch that I think cures the problem.
>>
> Hmm, that doesn't quite work because the table might not actually be
> rewritten as a result of the type change. For example:
>
> DROP TABLE IF EXISTS foo;
> CREATE TABLE foo (a int);
> INSERT INTO foo VALUES (1);
> ALTER TABLE foo ADD COLUMN b varchar(10) DEFAULT 'xxx';
> ALTER TABLE foo ALTER COLUMN b SET DEFAULT 'yyy';
> INSERT INTO foo VALUES (2);
> SELECT * FROM foo;
>  a |  b
> ---+-----
>  1 | xxx
>  2 | yyy
> (2 rows)
>
> ALTER TABLE foo ALTER COLUMN b TYPE varchar(20) USING b::varchar(20);
> SELECT * FROM foo;
>  a |  b
> ---+-----
>  1 |
>  2 | yyy
> (2 rows)
>


Ouch, OK, looks like we need something more complex.


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: <9e4caaa2-e2af-fd7f-e864-ae67e9560579@2ndQuadrant.com>
Permalink:  ../9e4caaa2-e2af-fd7f-e864-ae67e9560579@2ndQuadrant.com/
Also on:    postgresql.org/message-id/9e4caaa2-e2af-fd7f-e864-ae67e9560579@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, dean.a.rasheed@gmail.com, andres@anarazel.de, tgl@sss.pgh.pa.us, aldarund@gmail.com, alvherre@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: BUG #15446: Crash on ALTER TABLE
  In-Reply-To: <9e4caaa2-e2af-fd7f-e864-ae67e9560579@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> <1f382801-d55c-bc0b-b632-0731867091e4@2ndQuadrant.com> <CAEZATCVs=0qAggyb7MGtab_OQ6LWiGW8gx00wQuu=ZqqVwASrQ@mail.gmail.com> <9e4caaa2-e2af-fd7f-e864-ae67e9560579@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