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.98.2) (envelope-from ) id 1xD78E-00000000K6E-1GfK for pgsql-bugs@arkaria.postgresql.org; Sat, 03 Oct 2026 21:18:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xD78D-00000003FFB-1OiS for pgsql-bugs@arkaria.postgresql.org; Sat, 03 Oct 2026 21:18:57 +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.98.2) (envelope-from ) id 1xCltG-00000001Tym-3jCh for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:38: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 1xCltE-000000004rP-3dZi for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:38:06 +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=zbXA33yRwApOSijyRUngU3NR3CGa01BKxWMZ3W2VqvE=; b=eFCs3kg9k5XK9KBbzF720udTu4 iY6/DH6F5UEcTcq+vJzXsN4NnjVN6g5nSFq1Aw0Wr3aCLmxg2t33Dx5mxXd3ZbsLjLre5Egm+I4/L O0r6RIyDp/c9XvsL+GLhtvcO7LQgYNm1gHdz70H8XdK28jQvjngZuO25XfffgXvx6Hdl9lVvJQEGk 5EQjDOw0eWNcOIXkxX1bO6sfjeTncF4itGYg7fSieABMwCwwpov+nhIzV51AU3QlK5EwSlYUmGOKj 9SxILqQy4Voy6OlzBymMNxjRchr/E9j5YwXBM+lt/B34HocAV5Z9gUgSBWzWOkwQm2ajgAwKw9+cu +xEUOiTw==; 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.98.2) (envelope-from ) id 1xCltE-00000000JBs-1Vzm for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:38:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xCltD-00000000sf4-0xY7 for pgsql-bugs@lists.postgresql.org; Fri, 02 Oct 2026 22:38:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19739: Parameterized first autocommit statement can have different `transaction_timestamp()` and `statement To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: theshallow27@gmail.com Reply-To: theshallow27@gmail.com, pgsql-bugs@lists.postgresql.org Date: Fri, 02 Oct 2026 22:37:31 +0000 Message-ID: <19739-bdca3e8fd9b496fa@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: 19739 Logged by: Shallow Email address: theshallow27@gmail.com PostgreSQL version: 18.6 Operating system: Linux Description: =20 The documentation says `transaction_timestamp()` and `statement_timestamp()` return the same value during the first statement of a transaction. With a parameterized query executed as the first command on a fresh autocommit connection, they differ. The same query without parameters returns equality. Parameterized execution uses the extended query protocol, so this may expose a distinction between Parse/Bind/Execute message timing and the documented =E2=80=9Cfirst statement=E2=80=9D guarantee. **Reproduction:** Using Psycopg with autocommit enabled on a fresh connection: ```python cur.execute( "SELECT transaction_timestamp() =3D statement_timestamp() WHERE %s::int= =3D 0", (0,), ) print(cur.fetchone()) # (False,) ``` Control query on a fresh autocommit connection: ```sql SELECT transaction_timestamp() =3D statement_timestamp(); -- true ``` **Expected result:** The parameterized query, as the first SQL statement in an implicit transaction, should return `true`; alternatively, the documentation should clarify how extended-protocol messages affect the guarantee.