I would like to use views and allow updates. What are the postgresql
limitations imposed on views that restrict updates?
I tried the following and could not update the view, but would like
something more concrete about what the actual limiatations are.
Thanks for your help.
Cheers,
Brook
===========================================================================
drop table view_table_1;
create table view_table_1 (id int, name text);
drop table view_table_2;
create table view_table_2 (id int, telephone text);
drop table view_table_3;
create table view_table_3 (name_id int, phone_id int);
insert into view_table_1 (id, name) values (1, 'tom');
insert into view_table_1 (id, name) values (2, 'mary');
insert into view_table_2 (id, telephone) values (1, '555-1212');
insert into view_table_2 (id, telephone) values (2, '(505) 555-1212');
insert into view_table_3 (name_id, phone_id) values (1, 1);
insert into view_table_3 (name_id, phone_id) values (2, 2);
select * from view_table_1;
select * from view_table_2;
select * from view_table_3;
drop view view_table;
create view view_table as select names.name, phones.telephone
from view_table_1 names, view_table_2 phones
where names.id = view_table_3.name_id
and phones.id = view_table_3.phone_id;
select * from view_table;
-- update fails
update view_table set telephone = '505-555-1212';
select * from view_table;