pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail
4+ messages / 4 participants
[nested] [flat]
* BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail
@ 2018-06-19 04:19 PG Bug reporting form <noreply@postgresql.org>
2018-06-19 05:50 ` Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail Michael Paquier <michael@paquier.xyz>
2018-06-19 06:05 ` Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail Andrew Gierth <andrew@tao11.riddles.org.uk>
0 siblings, 2 replies; 4+ messages in thread
From: PG Bug reporting form @ 2018-06-19 04:19 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: liguangxian1995@gmail.com
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;
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail
2018-06-19 04:19 BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail PG Bug reporting form <noreply@postgresql.org>
@ 2018-06-19 05:50 ` Michael Paquier <michael@paquier.xyz>
1 sibling, 0 replies; 4+ messages in thread
From: Michael Paquier @ 2018-06-19 05:50 UTC (permalink / raw)
To: liguangxian1995@gmail.com; pgsql-bugs@lists.postgresql.org
On Tue, Jun 19, 2018 at 04:19:55AM +0000, PG Bug reporting form wrote:
> (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().
Well, you are directly manipulating a catalog with a DML query, which is
not a supported operation, so you are shooting yourself in the foot
here. There are many more and various ways to trigger failures.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail
2018-06-19 04:19 BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail PG Bug reporting form <noreply@postgresql.org>
@ 2018-06-19 06:05 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2018-06-19 14:23 ` Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Gierth @ 2018-06-19 06:05 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; liguangxian1995@gmail.com
>>>>> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:
PG> (4) update pg_attribute set attmissingval = NULL where attname = 'b';
Nobody ever claimed that you could update pg_attribute without crashing
the server; I can think of half a dozen ways to do it.
--
Andrew (irc:RhodiumToad)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail
2018-06-19 04:19 BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail PG Bug reporting form <noreply@postgresql.org>
2018-06-19 06:05 ` Re: BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail Andrew Gierth <andrew@tao11.riddles.org.uk>
@ 2018-06-19 14:23 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2018-06-19 14:23 UTC (permalink / raw)
To: Andrew Gierth <andrew@tao11.riddles.org.uk>; +Cc: pgsql-bugs@lists.postgresql.org; liguangxian1995@gmail.com
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:
> PG> (4) update pg_attribute set attmissingval = NULL where attname = 'b';
> Nobody ever claimed that you could update pg_attribute without crashing
> the server; I can think of half a dozen ways to do it.
Specifically, you broke it by not keeping atthasmissing consistent with
attmissingval. Manually corrupting catalogs like that is not a supported
operation.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2018-06-19 14:23 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 04:19 BUG #15247: At 'ALTER TABLE ADD COLUMN fast default' , Set attmissingval to NULL in the pg_attribute, query fail PG Bug reporting form <noreply@postgresql.org>
2018-06-19 05:50 ` Michael Paquier <michael@paquier.xyz>
2018-06-19 06:05 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2018-06-19 14:23 ` Tom Lane <tgl@sss.pgh.pa.us>
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