Обсуждение: insert rows into view
how can i insert/update/delete a row into a view?
i read in the manual that i have to use a rule for the
table, but for me it is not working.
here are the codes for the view, and the rule:
DROP VIEW plant_unit_view;
CREATE VIEW plant_unit_view AS SELECT * FROM
plant_unit;
DROP RULE plant_unit_rule;
CREATE RULE plant_unit_rule AS
ON INSERT TO plant_unit
DO INSTEAD INSERT INTO plant_unit
(pu_code, pu_name, unit_id, pu_type,
job_id, mod_user, mod_date)
VALUES
(new.pu_code, new.pu_name, new.unit_id,
new.pu_type, new.job_id, new.mod_user, new.mod_date);
Ivan
__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
"...DO INSTEAD INSERT INTO plant_unit..."
...DO INSTEAD INSERT INTO plant_unit_VIEW...
^^^^
DAQ
OOPS! Sorry!
This will be better:
"...ON INSERT TO plant_unit..."
...ON INSERT TO plant_unit_view...
^^^^
DAQ
yes i found out as well thank you, it is working Ivan --- daq <daq@ugyvitelszolgaltato.hu> wrote: > OOPS! Sorry! > This will be better: > > "...ON INSERT TO plant_unit..." > > ...ON INSERT TO plant_unit_view... > ^^^^ > > DAQ > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the > unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/