Re: Add support for data change delta tables

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Thomas Kellerer <shammat(at)gmx(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Add support for data change delta tables
Date: 2024-01-15 16:16:36
Message-ID: 2ada5104-143d-4a5b-bbbe-236f623d99d2@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message arun chirappurath 2024-01-15 16:16:55 Unable to find column
Previous Message Adrian Klaver 2024-01-15 16:10:11 Re: data migration using EXTENSION tds_fdw