pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Thomas Kellerer <shammat@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Add support for data change delta tables
Date: Mon, 15 Jan 2024 08:16:36 -0800
Message-ID: <2ada5104-143d-4a5b-bbbe-236f623d99d2@aklaver.com> (raw)
In-Reply-To: <60e814a5-72fc-453f-a345-7d840e3c204c@gmx.net>
References: <4f12dcdb-6d17-22a9-14e7-c006c97f5fab@gmail.com>
	<60e814a5-72fc-453f-a345-7d840e3c204c@gmx.net>

On 1/15/24 02:44, Thomas Kellerer wrote:
> PavelTurk schrieb am 15.01.2024 um 11:00:
>> Currently PostgreSQL doesn't support data change delta tables. For example, it doesn't support this type of query:
>>
>> SELECT * FROM NEW TABLE (
>>      INSERT INTO phone_book
>>      VALUES ( 'Peter Doe', '555-2323' )
>> ) AS t
>>
>> PostgreSQL has RETURNING that provides only a subset of this functionality.
>>
>> So I suggest to add support for data change delta tables. Because this feature is more powerful and it is included
>> in the SQL Standard.
> 
> I don't know that syntax, but it seems to me, it's basically this:
> 
> with t as (
>     INSERT INTO phone_book
>     VALUES ( 'Peter Doe', '555-2323' )
>     returning *
> )
> select *
> from t;
> 


There is also transition relations:

https://www.postgresql.org/docs/current/sql-createtrigger.html

though that involves creating a trigger on a table.

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (9+ messages)  latest in thread

Message-ID: <2ada5104-143d-4a5b-bbbe-236f623d99d2@aklaver.com>
Permalink:  ../2ada5104-143d-4a5b-bbbe-236f623d99d2@aklaver.com/
Also on:    postgresql.org/message-id/2ada5104-143d-4a5b-bbbe-236f623d99d2@aklaver.com

 · 

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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, shammat@gmx.net
  Subject: Re: Add support for data change delta tables
  In-Reply-To: <2ada5104-143d-4a5b-bbbe-236f623d99d2@aklaver.com>
  References: <4f12dcdb-6d17-22a9-14e7-c006c97f5fab@gmail.com> <60e814a5-72fc-453f-a345-7d840e3c204c@gmx.net> <2ada5104-143d-4a5b-bbbe-236f623d99d2@aklaver.com>

* 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