Inserting into views - Mailing list pgsql-general

From Richard Harvey Chapman
Subject Inserting into views
Date
Msg-id Pine.LNX.4.10.10006271957170.14843-100000@smile.3gfp.com
Whole thread Raw
Responses Re: Inserting into views  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Is this allowed in Postgresql?

It "appears" to work, but then doesn't.

R.
----
test=# create table liar (num integer, name varchar(20));
CREATE
test=# insert into liar values (32, 'Bill');
INSERT 31754 1
test=# insert into liar values (2, 'Joey');
INSERT 31755 1
test=# insert into liar values (6, 'Felicia');
INSERT 31756 1
test=# select * from liar;
 num |  name
-----+---------
  32 | Bill
   2 | Joey
   6 | Felicia
(3 rows)

test=# create view liar_view as select num, name, num as fodder from liar;
CREATE 31768 1
test=# SELECT * from liar_view ;
 num |  name   | fodder
-----+---------+--------
  32 | Bill    |     32
   2 | Joey    |      2
   6 | Felicia |      6
(3 rows)

test=# insert into liar_view (num, name) values (43, 'Jane');
INSERT 31769 1
test=# SELECT * from liar_view ;
 num |  name   | fodder
-----+---------+--------
  32 | Bill    |     32
   2 | Joey    |      2
   6 | Felicia |      6
(3 rows)

test=# select * from liar;
 num |  name
-----+---------
  32 | Bill
   2 | Joey
   6 | Felicia
(3 rows)

test=# insert into liar_view (num, name, fodder) values (43, 'Jane', 43);
INSERT 31770 1


pgsql-general by date:

Previous
From: Richard Harvey Chapman
Date:
Subject: Re: Re: PostgreSQL General Digest V1 #266
Next
From: "Howard"
Date:
Subject: Connecting postgreSQL using JDBC