Jan Wieck wrote:
> > I'm convinced that pg_dump / psql restore doesn't seem to restore VIEWs
> > properly. Anybody else seen this?
>
> More details please!
It seems to be extremely easy to reproduce...
chris=> create table foo(a int4, b int4);
CREATE
chris=> insert into foo values(3, 4);
INSERT 1484426 1
chris=> create view bar as SELECT a + b FROM foo;
CREATE
chris=> select * from bar;
?column?
-------- 7
(1 row)
EOFis=>
chris@tech!26!bash:~$ pg_dump chris -o >foo
chris@tech!27!bash:~$ createdb foobar
chris@tech!28!bash:~$ psql !$ <foo
psql foobar <foo
CREATE TABLE pgdump_oid (dummy int4);
CREATE
COPY pgdump_oid WITH OIDS FROM stdin;
DROP TABLE pgdump_oid;
DROP
CREATE TABLE "foo" ( "a" int4, "b" int4);
CREATE
CREATE TABLE "bar" ( "?column?" int4);
CREATE
COPY "foo" WITH OIDS FROM stdin;
CREATE RULE "_RETbar" AS ON SELECT TO "bar" WHERE DO INSTEAD SELECT "a"
+ "b" F
ROM "foo";
ERROR: parser: parse error at or near "do"
EOF
chris@tech!29!bash:~$ psql foobar
Welcome to the POSTGRESQL interactive sql monitor: Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.5.0 on i686-pc-linux-gnu, compiled by gcc 2.7.2.3]
type \? for help on slash commands type \q to quit type \g or terminate with semicolon to execute queryYou are
currentlyconnected to the database: foobar
foobar=> select * from foo;
a|b
-+-
3|4
(1 row)
foobar=> select * from bar;
?column?
--------
(0 rows)
foobar=>