Re: [BUGS] postgresql-6.1.1: insert into XXX select * from YYY does not working where YYY are view.

Started by Bruce Momjianover 28 years ago1 messageshackers
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Fixed in 6.3. Beta is Feb 1.

sql query "insert into XXX select * from YYY" does not working if
YYY are view.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

[ic@cms ic]$ createdb bugexample
[ic@cms ic]$ psql bugexample
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL

type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: bugexample

bugexample=> create table foo ( x int );
CREATE
bugexample=> insert into foo values (1);
INSERT 3035758
bugexample=> insert into foo values (2);
INSERT 3035759
bugexample=> select * from foo;
x
-
1
2
(2 rows)

bugexample=> create view bar as select * from foo;
CREATE
bugexample=> select * from bar;
x
-
1
2
(2 rows)

bugexample=> create table foobar ( x int );
CREATE
bugexample=> insert into foobar select * from bar;
INSERT 0
bugexample=> select * from foobar;
x
-
(0 rows)

bugexample=>

NOTE: This bug also hapenes if we runing
"insert into XXX (F1,F2...) select F1,F2... from YYY",
or if we select from multiple tables and one or more tables
are views, independant of "where ...." expression.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

?

ic

P.S. Sorry for my bad english grammatic ... :-(

--
Bruce Momjian
maillist@candle.pha.pa.us