pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: liguangxian1995@gmail.com
Subject: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail
Date: Tue, 19 Jun 2018 04:19:55 +0000
Message-ID: <152938199549.1445.15943776243848338882@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15247
Logged by:          guangxian li
Email address:      liguangxian1995@gmail.com
PostgreSQL version: 11beta1
Operating system:   debian 6.4.0
Description:        

Dear developer:
Steps:
(1)  create table test(a int);
(2)  insert into test values(1),(2),(3);
(3)  alter table test add b int not null default 0;
(4)  update pg_attribute set attmissingval = NULL where attname = 'b';
(5) select b from test;
Then,query the b field from the test table(select b from test;) , lead to
server closed the connection unexpectedly .

I think this a bug ,or not.  Meanwhile,I think we should add an statement
--if(att->atthasmissing && tupleDesc->constr->missing) .Not Assert().

So, Hope to get your reply,Thanks  again. 

                                                                            
                           
Next is a patch.

inline patch 1: src/backend/access/common/heaptuple.c (+1/-1 lines) download inline-1.patch--- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -91,7 +91,7 @@ getmissingattr(TupleDesc tupleDesc, att = TupleDescAttr(tupleDesc, attnum - 1); - if (att->atthasmissing) + if (att->atthasmissing && tupleDesc->constr->missing) { AttrMissing *attrmiss;

view thread (4+ messages)  latest in thread

Message-ID: <152938199549.1445.15943776243848338882@wrigleys.postgresql.org>
Permalink:  ../152938199549.1445.15943776243848338882@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/152938199549.1445.15943776243848338882@wrigleys.postgresql.org

 ·  · 

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: noreply@postgresql.org, liguangxian1995@gmail.com
  Subject: Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail
  In-Reply-To: <152938199549.1445.15943776243848338882@wrigleys.postgresql.org>
  References: <152938199549.1445.15943776243848338882@wrigleys.postgresql.org>

* 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