| From: | dbalazs(at)homemail(dot)com |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | view's rule -> update |
| Date: | 2000-07-30 16:23:00 |
| Message-ID: | XFMail.20000730182300.balazs@napraforgo.penguinpowered.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Hello,
I would liko to update a table from a view's rule:
The environment:
-------------------------------
CREATE TABLE real (name text);
CREATE TABLE alibi (name text);
CREATE TABLE alibi_view (name text);
CREATE RULE "_RETalibi_view" AS ON SELECT TO alibi_view DO INSTEAD
SELECT name FROM alibi;
CREATE RULE "_UPDalibi_view" AS ON UPDATE TO alibi_view DO INSTEAD
UPDATE real SET
name=NEW.name
--WHERE name=OLD.name
;
INSERT INTO real VALUES ('first');
INSERT INTO real VALUES ('sec');
-------------------------------
UPDATE alibi_view SET name='new' WHERE name='sec';
--> UPDATE 0 ...it is my problem
UPDATE alibi_view SET name='new';
--> UPDATE 2 ... it is OK
If I don't comment the line "where .." in the rule _UPDalibi_view
, it isn't working at all.
Can I do this with rule?
(I need the view to controll permissions.)
Thanks in advance,
DBalazs
(postgresql 7.02)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Itai Zukerman | 2000-07-31 13:44:18 | Indices and time spans |
| Previous Message | Robert B. Easter | 2000-07-29 19:27:52 | Re: Conditional rule? |