Skip site navigation (1) Skip section navigation (2)

insert after table modify bug

From: "Jan Urbanek" <JURB6630(at)Barbora(dot)ms(dot)mff(dot)cuni(dot)cz>
To: pgsql-bugs(at)postgresql(dot)org
Subject: insert after table modify bug
Date: 2000-04-08 22:37:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs

I have found a transaction problem in 6.5.3. This is an example:

create table a (a1 int4,a2 int4);
create table b (b1 int4);
alter table b add column b2 int4;
insert into b select * from a ;
ERROR:  INSERT has more expressions than target columns

The db sees new table b, but thinks it has only one column: if I try
"select * from b;" after the alter table command, I receive:
(0 rows)

Moreover, I found another bug, but it seems it's the same as reported 
Radhesh Mohandas at Feb, 4:

Drop table a;
Drop table b;
-- now the second drop failed, e.g. table b doesn't exist - and I 
-- want to roll back the whole transaction

Table a "does" and "doesn't" exist: it cannot be created but every 
select from a failes.
I found the only way how to fix the problem: delete these tables from 
system tables, this means "delete from pg_class where relname='a'" 
and then "delete from pg_type where typname='a'". Then execute vacuum, 
which should, I think, synchronize indices. I tried it and it worked.

Don't you have anybody better solution?

Jan Urbanek


pgsql-bugs by date

Next:From: Tom LaneDate: 2000-04-08 23:25:55
Subject: Re: insert after table modify bug
Previous:From: Tom LaneDate: 2000-04-07 22:19:07
Subject: Re: 7beta3 has naughty parser bug with ALTER USER .. PASSWORD

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group