pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brook Milligan <brook@trillium.NMSU.Edu>
To: pgsql-sql@postgresql.org
Subject: limitations of views?
Date: Wed, 15 Jul 1998 11:21:35 -0600 (MDT)
Message-ID: <199807151721.LAA10781@trillium.nmsu.edu> (raw)

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;



Message-ID: <199807151721.LAA10781@trillium.nmsu.edu>
Permalink:  ../199807151721.LAA10781@trillium.nmsu.edu/
Also on:    postgresql.org/message-id/199807151721.LAA10781@trillium.nmsu.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: brook@trillium.NMSU.Edu
  Subject: Re: limitations of views?
  In-Reply-To: <199807151721.LAA10781@trillium.nmsu.edu>
  References: <199807151721.LAA10781@trillium.nmsu.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox