From: | Zakkr <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Bug(?) in pg_get_ruledef() |
Date: | 1999-10-27 10:37:44 |
Message-ID: | Pine.LNX.3.96.991027123327.6743A-100000@ara.zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I try dump (via pg_dump) my database, but if I write dumped data back to DB,
views (as select on ingerit table) not work.
The bug is in routine pg_get_ruledef(pg_rewrite.rulename), which _not_
discern between select on standard table and select on inderit table.
Select on inherit table is "SELECT * FROM table*", but pg_get_ruledef()
return this view definition without asterisk: "SELECT * FROM table".
See example:
-----------
abil=> create table mother_tab (aaa int);
CREATE
abil=> create table son () inherits(mother_tab);
CREATE
abil=> create view v_mother as select * from mother_tab*;
CREATE
abil=> insert into son values (111);
INSERT 4946878 1
abil=> select * from v_mother;
aaa
---
111
(1 row)
abil=> SELECT pg_get_ruledef(pg_rewrite.rulename) FROM pg_rewrite WHERE
rulename ='_RETv_mother';
CREATE RULE "_RETv_mother" AS ON SELECT TO "v_mother" DO INSTEAD SELECT
"mother_tab"."aaa" FROM "mother_tab";
(1 row)
^^^^^^^^^^^^
right is "mother_tab*"
-----
Is it but?
(It is probably fatal bug if somebody backup batabase via pg_dump and views
from dump is unavailable.)
Karel Z.
------------------------------------------------------------------------------
<zakkr(at)zf(dot)jcu(dot)cz> http://home.zf.jcu.cz/~zakkr/
Kim Project: http://home.zf.jcu.cz/~zakkr/kim/ (process manager)
FTP: ftp://ftp2.zf.jcu.cz/users/zakkr/ (C/ncurses/PgSQL)
------------------------------------------------------------------------------
...and cathedral dilapidate
From | Date | Subject | |
---|---|---|---|
Next Message | Keith Parks | 1999-10-27 11:02:21 | Syntax error in psqlHelp.h |
Previous Message | Hiroshi Inoue | 1999-10-27 09:45:49 | RE: System indexes are never unique indexes( was RE: [HACKERS] mdnblocksis |