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 1ve2yP-008FvS-2y for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Jan 2026 03:15:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1ve2yO-005W4g-0U for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Jan 2026 03:15:36 +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 1ve2yN-005W4Y-2i for pgsql-hackers@lists.postgresql.org; Fri, 09 Jan 2026 03:15:36 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ve2yN-00507A-02 for pgsql-hackers@lists.postgresql.org; Fri, 09 Jan 2026 03:15:35 +0000 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-34c9edf63a7so3112493a91.1 for ; Thu, 08 Jan 2026 19:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767928533; x=1768533333; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=WjSoO2pBhB5Jr4iolmbfhggLB+Hiur2kZ77hEd8GH+M=; b=hfA78+nkrPdB7rgRtr1Z8dPzyK+8hrxUPbIo0PFZmvkvpu6qTL13K6iw7tAwJvmLCf EFILUtdv0tmNjPjogCmlbhm0b08yJv2XX635fSevsm//vZFGdPRgEfurlnO9qHohsRn/ EtOxK1j9vpgArt0Ej4U0S3ooPD/joOlldXR6U63yqlzwvEVmzS8orMSdH9937NAqIbGT adOIoS4+cYvtp7gUbg+xIoUISz7toT8GC8laXsq86iHdgpGdDcU3fefvS3n2Os/XkgOq pqKGvyR9JnGt4IhvyLzh+CXI/4/dYarXndyz9ObaGoTbP10dymoMP3QAGvQ2Ci1VhOOy +zww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767928533; x=1768533333; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WjSoO2pBhB5Jr4iolmbfhggLB+Hiur2kZ77hEd8GH+M=; b=MQB5uqP3pOOhh760uYTo2B/yaCeTDYRr34lmwU8DWRoyDqLYYAHyop4a/iIdtINYVq UWCrih5iuECAOSVpzB6npt+MMDAlg+Ey2DQ5uZj5M5XodNtwZ3MCh0BJAGetE5MTz6zV 2dZJYuR376X8oiHGMa4D2KrunhQPVrzWZAr5nrqEXC85bVsM0wCmll1bVZSx9fxiQ6ZO qCZeGzNviZthvqlNzt4qCpRoF+y6Hf8JIeR3Fc8mJIN08ypVRuRX/MUMQDmg+MB7rxKt WpfZ5uXED1SMbZsmFetPcawHp3DWCG4XWAtd6b5NOBi2+8h6mpvN0n4N2tsOOIvEYQld fBsQ== X-Forwarded-Encrypted: i=1; AJvYcCVEB9aE9vN1IW9y2uAmO+b1yhAliaUhZC4zeMm8N4rkhayNvNclp7s2DNPHtHOWQ8IZa8SrivP8cf9dba1i@lists.postgresql.org X-Gm-Message-State: AOJu0YyIgso2kYOEhiFOcGv94UKRxn4imEdX2byhrDkgxusgVImZfVKK A+1JoSB+JgjOHSRFTZrg/GOPl1Mx6Gd78SPXGZd2D1dhq0Jd9zADinlFvItCgVAUvccfEfQHFcj 2mVTtkwgxDNkawTjNSzVIvUm3YYbLjjM= X-Gm-Gg: AY/fxX7B+OXTS+086hHqrUiJxhsZ0UGn2fYkQwuMZQLGuUsTagXgB2D9tT8LjPMC/gi QzyuJ4r1cAh0QY/m6PwhPZbi+16hS1fmXQd47nbWga1+7SIo/tUz0kk1v5JMhggdLiy37r4C9cT BkpC/uavo2CN0ZWUkxQSjt4MVcZkuILGkXn3fByhz7wzqU//lpTxfDvI6WPtUJAoSMaSjC2j7jg wn1vp4vrQoTWBLopOO2X3UjveK4+sUFMbMkz0PPlK3SP0XyvwLSsJwTQygOfhqhC5EMrb5bIziS rdpslSJOl75CfSCAV7mvQbAWhzI= X-Google-Smtp-Source: AGHT+IEzDOUhgoPenHC87xbqFxcL9TH8vEgHZJfMCgjE95jwg4+2W1eK4LH5cM3zd8XRgzjI6Ht7KM9U+WvAIurUeGI= X-Received: by 2002:a17:90b:3903:b0:340:ca7d:936a with SMTP id 98e67ed59e1d1-34f68d0bc06mr7778977a91.18.1767928533212; Thu, 08 Jan 2026 19:15:33 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: assam258@gmail.com From: Henson Choi Date: Fri, 9 Jan 2026 12:15:21 +0900 X-Gm-Features: AQt7F2qBnAPMlBTnwf_FcvKzPqrQ-NKVKWgBNPQk3z3LIPglgrGnJw56RIdREYU Message-ID: Subject: Re: [PATCH] Add pg_current_vxact_id() function to expose virtual transaction IDs To: Michael Paquier Cc: Pavlo Golub , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000035e72a0647ebf005" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000035e72a0647ebf005 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2026=EB=85=84 1=EC=9B=94 9=EC=9D=BC (=EA=B8=88) AM 9:25, Michael Paquier =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > On Mon, Dec 08, 2025 at 12:09:58PM +0000, Pavlo Golub wrote: > > Virtual transaction IDs are fundamental to PostgreSQL's transaction > > tracking, > > appearing in pg_locks.virtualtransaction, log output via %v placeholder= , > and > > internal transaction management. However, there's currently no direct S= QL > > function to retrieve the current VXID, forcing applications to query > > pg_locks > > or parse log files to obtain this information. > > This is replacing one SQL in a given session by another, as a session > currently running a transaction can query itself pg_locks and match an > entry with its own pg_backend_pid(). Hence I don't see the need for > this function, except simplicity in retrieving a session's state with > less characters typed at the end? > I see this as a tradeoff between minor convenience and negligible addition cost. The community should decide whether this tradeoff is worth it. > Thoughts and opinions from others are welcome. I'm always OK to be > outvoted. > -- > Michael > Best regards, Henson Choi --00000000000035e72a0647ebf005 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


2026=EB=85=84 1= =EC=9B=94 9=EC=9D=BC (=EA=B8=88) AM 9:25, Michael Paquier <michael@paquier.xyz>=EB=8B=98=EC=9D=B4 =EC= =9E=91=EC=84=B1:
On Mon, Dec 08, 2025 at 12:09:58= PM +0000, Pavlo Golub wrote:
> Virtual transaction IDs are fundamental to PostgreSQL's transactio= n
> tracking,
> appearing in pg_locks.virtualtransaction, log output via %v placeholde= r, and
> internal transaction management. However, there's currently no dir= ect SQL
> function to retrieve the current VXID, forcing applications to query > pg_locks
> or parse log files to obtain this information.

This is replacing one SQL in a given session by another, as a session
currently running a transaction can query itself pg_locks and match an
entry with its own pg_backend_pid().=C2=A0 Hence I don't see the need f= or
this function, except simplicity in retrieving a session's state with less characters typed at the end?

I see this= as a tradeoff between minor convenience and negligible
addition cost.<= br>
The community should decide whether this tradeoff is worth it.

Thoughts and opinions from others are welcome.=C2=A0 I'm always OK to b= e
outvoted.
--
Michael

Best regards,
Henson Choi=C2= =A0
=C2=A0
--00000000000035e72a0647ebf005--