pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: ariel@mashraki.co.il
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16087: Segmentation fault on ALTER TABLE
Date: Tue, 29 Oct 2019 11:26:14 -0400
Message-ID: <23031.1572362774@sss.pgh.pa.us> (raw)
In-Reply-To: <16087-c583d912ecb36614@postgresql.org>
References: <16087-c583d912ecb36614@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> Running ALTER TABLE with both ALTER COLUMN and ADD COLUMN causes a database
> segfault. It happens constantly on version 12 and doesn't reproduce on
> version 11 and 10.
> Attaching here a set of commands (and their output) to help reproducing the
> issue ($ means start of a command).

> $ create table "users" (id bigint not null generated by default as identity,
> age int not null, primary key(id));
> $ insert into users (age) values(1);
> $ alter table "users" alter column "age" type bigint, add column "nickname"
> text;

Thanks for the report!  I failed to reproduce a crash here, but I think
that means that the bug is already fixed.  It looks like this probably
matches this recent commit:

Author: Andres Freund <andres@anarazel.de>
Branch: master [93765bd95] 2019-10-09 22:00:50 -0700
Branch: REL_12_STABLE [f224c7c11] 2019-10-09 22:13:48 -0700

    Fix table rewrites that include a column without a default.
    
    In c2fe139c201c I made ATRewriteTable() use tuple slots. Unfortunately
    I did not notice that columns can be added in a rewrite that do not
    have a default, when another column is added/altered requiring one.
    
    Initialize columns to NULL again, and add tests.
    
    Bug: #16038
    Reported-By: anonymous
    Author: Andres Freund
    Discussion: https://postgr.es/m/16038-5c974541f2bf6749@postgresql.org
    Backpatch: 12, where the bug was introduced in c2fe139c201c

			regards, tom lane





view thread (2+ messages)

Message-ID: <23031.1572362774@sss.pgh.pa.us>
Permalink:  ../23031.1572362774@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23031.1572362774@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, ariel@mashraki.co.il
  Subject: Re: BUG #16087: Segmentation fault on ALTER TABLE
  In-Reply-To: <23031.1572362774@sss.pgh.pa.us>
  References: <16087-c583d912ecb36614@postgresql.org> <23031.1572362774@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