Press "Enter" to skip to content

RETURNING Clause in PostgreSQL Update Operations

Hans-Jürgen Schönig wants the output:

PostgreSQL 18 offers a couple of new features such as asynchronous I/O (aio), improvements around indexing, and a lot more. However, there is one feature that has really caught my attention. While it might go unnoticed by many users, it is really powerful and, to me, somehow represents everything I like about PostgreSQL.

The improvement I want to focus on today is related to the way the “RETURNING-clause” works in PostgreSQL 18.

This behavior is very much like the OUTPUT clause in T-SQL. Though it appears that OLD and NEW are not themselves pseudotables like SQL Server’s INSERTED and DELETED, as there is an example that includes old and new columns together in the same row.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.