<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: PostgreSQL 18: Add OLD/NEW support to RETURNING in DML queries	</title>
	<atom:link href="https://www.dbi-services.com/blog/postgresql-18-add-old-new-support-to-returning-in-dml-queries/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbi-services.com/blog/postgresql-18-add-old-new-support-to-returning-in-dml-queries/</link>
	<description></description>
	<lastBuildDate>Mon, 27 Jan 2025 12:08:34 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Daniel Westermann		</title>
		<link>https://www.dbi-services.com/blog/postgresql-18-add-old-new-support-to-returning-in-dml-queries/#comment-3686</link>

		<dc:creator><![CDATA[Daniel Westermann]]></dc:creator>
		<pubDate>Mon, 27 Jan 2025 12:08:34 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbi-services.com/blog/?p=36798#comment-3686</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.dbi-services.com/blog/postgresql-18-add-old-new-support-to-returning-in-dml-queries/#comment-3685&quot;&gt;Tobias Bussmann&lt;/a&gt;.

Thank you, Tobias]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.dbi-services.com/blog/postgresql-18-add-old-new-support-to-returning-in-dml-queries/#comment-3685">Tobias Bussmann</a>.</p>
<p>Thank you, Tobias</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Tobias Bussmann		</title>
		<link>https://www.dbi-services.com/blog/postgresql-18-add-old-new-support-to-returning-in-dml-queries/#comment-3685</link>

		<dc:creator><![CDATA[Tobias Bussmann]]></dc:creator>
		<pubDate>Mon, 27 Jan 2025 11:58:12 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbi-services.com/blog/?p=36798#comment-3685</guid>

					<description><![CDATA[It&#039;s a very nice syntax addition indeed. In older versions of PostgreSQL, you can achieve the same result by doing a self-join on the table to be updated:

``` sql
CREATE TABLE change (i, name) AS
	SELECT i, &#039;old &#039; &#124;&#124; i FROM generate_series(1,3) i;

UPDATE change
SET name = &#039;new &#039; &#124;&#124; change.i
FROM change AS change_old
WHERE change.i = change_old.i
AND change.i &#062;= 2
RETURNING change.i, change_old.name AS old_name, change.name AS new_name;
```]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a very nice syntax addition indeed. In older versions of PostgreSQL, you can achieve the same result by doing a self-join on the table to be updated:</p>
<p>&#8220;` sql<br />
CREATE TABLE change (i, name) AS<br />
	SELECT i, &#8216;old &#8216; || i FROM generate_series(1,3) i;</p>
<p>UPDATE change<br />
SET name = &#8216;new &#8216; || change.i<br />
FROM change AS change_old<br />
WHERE change.i = change_old.i<br />
AND change.i &gt;= 2<br />
RETURNING change.i, change_old.name AS old_name, change.name AS new_name;<br />
&#8220;`</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: www.dbi-services.com @ 2026-07-13 17:26:49 by W3 Total Cache
-->