Re: Feature request: support queries with returning on simple views with automatic update

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Attila Soki <atiware(at)gmx(dot)net>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Feature request: support queries with returning on simple views with automatic update
Date: 2013-10-11 06:36:57
Message-ID: CAB7nPqRuVz58tQeSM8PyD8hcg7tpqSwObNH_mt1h7WR92Bou-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> it would be great if i could simply write 'insert into simple_view returning col1' or 'insert into simple_view returning col2' and postgres would make the magic behind.
You can do it with 9.3~ servers already. Here is an example:
=# create table aa (a int);
CREATE TABLE
=# insert into aa values (1);
INSERT 0 1
=# create view aav as select * from aa;
CREATE VIEW
=# insert into aav values (2) returning a;
a
---
2
(1 row)
INSERT 0 1
=# delete from aav where a = 1 returning a;
a
---
1
(1 row)
DELETE 1

Regards,
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-10-11 08:04:13 Re: postgresql9.1.6 core dump
Previous Message hiroyuki shiga 2013-10-11 04:43:06 postgresql9.1.6 core dump