Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXIqL-003BQi-28 for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jun 2026 13:19:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXIqK-00Bchb-1V for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jun 2026 13:19:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXFss-00AZMA-1B for pgsql-bugs@lists.postgresql.org; Wed, 10 Jun 2026 10:10:06 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wXFsq-00000001zU6-3b8L for pgsql-bugs@lists.postgresql.org; Wed, 10 Jun 2026 10:10:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=7Q3Zy8qWHe03mClZ0GEyO0OyDwy8YOXYaFNkgf3PzsY=; b=5ZBVpWYMna7tD9Vwnjfay0uSP9 aBU2GS2z3fV3EO6mLhVQb0MbmA9dhTq7fuHCQTHmqfMY5psF7O2PB0KgOVIee2C9rpei0HdLQiO6V 1NlD2EMbWrbWKn2jctMREwzQY70X2NxDcEPE50zPJ4AeoyUo502h2AuGfsja3WGSPdecrPXV+Bb5C 2ubi8ItweFwcOmic0sU8bx9x/9sn6gHcRLAdBEXk/CYrvVZU4ii3PtzyY89aH4z1AuUKgqN5OMI24 hn7rB5oTp6P5j4d3vK6iopOGZ4QVN4GjwgvWS6mMQzImOn6cfvWRngNf7sIz0jDdUwcuBZJzEOIh1 IcLZzUCw==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXFsq-006Ru1-1j for pgsql-bugs@lists.postgresql.org; Wed, 10 Jun 2026 10:10:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXFsp-00EaM8-0d for pgsql-bugs@lists.postgresql.org; Wed, 10 Jun 2026 10:10:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19516: Mixup of OLD/NEW with RETURNING when parenthesized To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: markoog@gmail.com Reply-To: markoog@gmail.com, pgsql-bugs@lists.postgresql.org Date: Wed, 10 Jun 2026 10:09:51 +0000 Message-ID: <19516-97e045ee5e78c98d@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19516 Logged by: Marko Grujic Email address: markoog@gmail.com PostgreSQL version: 18.4 Operating system: MacOS, Debian Description: =20 Hi, reporting a basic bug which involves a RETURNING clause on DML with parenthesized OLD/NEW. Effectively, the (parenthesized) row reference isn't being honored, and instead the default behavior is applied. Seeing this on tip of master as well (19beta1). postgres=3D# create table t(a int, b text); CREATE TABLE postgres=3D# insert into t values (1, 'one') returning (old).b, old.b, (new).b, new.b; b | b | b | b -----+---+-----+----- one | | one | one (1 row) INSERT 0 1 postgres=3D# update t set b =3D '1' where a =3D 1 returning (old).b, old.b, (new).b, new.b; b | b | b | b ---+-----+---+--- 1 | one | 1 | 1 (1 row) UPDATE 1 postgres=3D# delete from t where a =3D 1 returning (old).b, old.b, (new).b, new.b; b | b | b | b ---+---+---+--- 1 | 1 | 1 | (1 row) DELETE 1 postgres=3D# select version(); version ---------------------------------------------------------------------------= ----------------------------------------- PostgreSQL 18.4 (Debian 18.4-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit (1 row)