Thread: Re: [HACKERS] Pretty bad bug in Postgres.

Re: [HACKERS] Pretty bad bug in Postgres.

From
Bruce Momjian
Date:
Any comments on this?


> 
> Following is I believe evidence of a pretty bad bug in postgres. This is
> the 990329 snapshot.
> 
> When doing an insert into a table where one of the fields comes from a
> SELECT from another table, it seems that if the table has the "*" after
> it, to indicate sub-classes it doesn't work.
> 
> The database is fresh and there are no indexes.
> 
> The table looks like this....
> 
> CREATE TABLE category (
>   name text,
>   image text,
>   url text,
>   parent oid
> );
> 
> 
> httpd=> select * from category;
> name    |image|url|parent
> --------+-----+---+------
> foo     |foo  |   |     0
> bar     |bar  |   |158321
> Products|.gif |   |      
> (3 rows)
> 
> httpd=>  select oid, * FROM category* where name = 'foo';
>    oid|name|image|url|parent
> ------+----+-----+---+------
> 158321|foo |foo  |   |     0
> (1 row)
> 
> httpd=> insert into category(name, image, parent) SELECT 'boo', 'boo',
> oid FROM category* where name = 'foo';
> INSERT 158370 1
> httpd=> select * from category;
> name    |image|url|parent
> --------+-----+---+------
> foo     |foo  |   |     0
> bar     |bar  |   |158321
> Products|.gif |   |      
> (3 rows)
> 
> Ok, what's going on here. The 'boo' record did not appear!
> 
> httpd=> insert into category(name, image, parent) SELECT 'boo', 'boo',
> oid FROM category  where name = 'foo';
> INSERT 158374 1
> httpd=> select * from category;
> name    |image|url|parent
> --------+-----+---+------
> foo     |foo  |   |     0
> bar     |bar  |   |158321
> Products|.gif |   |      
> boo     |boo  |   |158321
> (4 rows)
> 
> We dropped the "*" from the FROM clause and now the record does appear.
> 
> A bug?
> 
> 
> -- 
> Chris Bitmead
> http://www.bigfoot.com/~chris.bitmead
> mailto:chris.bitmead@bigfoot.com
> 
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [HACKERS] Pretty bad bug in Postgres.

From
Vadim Mikheev
Date:
Bruce Momjian wrote:
> 
> Any comments on this?
> 
> >
> > Following is I believe evidence of a pretty bad bug in postgres. This is
> > the 990329 snapshot.       ^^^^^^
Snapshot's too old?

> > httpd=> insert into category(name, image, parent) SELECT 'boo', 'boo',
> > oid FROM category* where name = 'foo';
> > INSERT 158370 1
> > httpd=> select * from category;
> > name    |image|url|parent
> > --------+-----+---+------
> > foo     |foo  |   |     0
> > bar     |bar  |   |158321
> > Products|.gif |   |
> > (3 rows)
> >
> > Ok, what's going on here. The 'boo' record did not appear!

I can't reproduce this in current...

Vadim