Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ln7SC-0007Nb-ED for pgsql-admin@arkaria.postgresql.org; Sat, 29 May 2021 22:29:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ln7Rd-00009q-NE for pgsql-admin@arkaria.postgresql.org; Sat, 29 May 2021 22:28:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ln7Rd-00009i-Ec for pgsql-admin@lists.postgresql.org; Sat, 29 May 2021 22:28:37 +0000 Received: from mout.perfora.net ([74.208.4.194]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ln7Ra-000366-0Q for pgsql-admin@lists.postgresql.org; Sat, 29 May 2021 22:28:36 +0000 Received: from [192.168.1.165] ([98.169.214.254]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0M55Ka-1lThHU24WU-00zGJL; Sun, 30 May 2021 00:28:30 +0200 Subject: Re: equivalent of @@TRANCOUNT PostgreSQL To: Thomas Kellerer Cc: pgsql-admin@lists.postgresql.org References: <004101d7548b$894e0ce0$9bea26a0$@forenda.com.tr> <445011bb-b76d-9174-aebe-f6727944054d@gmx.net> From: MichaelDBA Message-ID: Date: Sat, 29 May 2021 18:28:26 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.48 MIME-Version: 1.0 In-Reply-To: <445011bb-b76d-9174-aebe-f6727944054d@gmx.net> Content-Type: text/plain; charset=windows-1254; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Provags-ID: V03:K1:UwHETK0pcAPQhTmJ20tVvYUkMYQd2DjJJhK/KQKgKM8mpd7nxa6 T1rB21iB5EGQrC4ZR0DYlhHY+cC4joudLqLG8OdhS8Iqz0V4ZpTvdwz/xmREFkKjv5eNLTu 7GJjM8nzXKSC7UVMMb6dmXnc5D182N9d1lIW1iFC1edwPYo41nWVFgpOrMZ+lQhSHJEv0oP XL4Px2hY7Q5/sKJTZwcfA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:AmrziJ/J+0A=:k1qrU+pjHa6QtlOtQXGByZ /38v3lcxYny30EC2ky9j1rUV4hv6RsQVAugJxqW0wVL0Pbyqavk6QRMo6/uLBfi3/TlOt7lWS mY53npKZ1G7pwwG7+Ir8SrFweDqZof5eds6wlrRTSxLYVst62iZ+x/kXpTxhuf+q3OCiVZvnI fDfkVNQB0WLSInA04niIVPpjRXVIrHrrI3ZUjFXg7b9Wfm+phnuXpZNGs7KG1ocHLA1fWJpaC Wt8FtMEHcXaY41y8l/RiB1SjVxw9o5u/dQOzgwR9Z3kQ0k8Tfv1n41I16D8QhR86qoJnaiuFj dc/w71ry3fJAX1EBUovcRlOLLNPpJiCMGlF5B8LHKYtni4iZ99pZqdNOfiMs/hu9R4Rn3VnFR ctQw0ptrQvIPV4TveoOennzJh+lOyJtOmaX1Wa6PmBZChu/GBio022yetKaxXDkdufQy+jUqh Fvs3vvyvF+nUBH7IaxqdSfVccp21Ak1Wvk6ptzBeMECukUVNEQ9QoGdjeX52TKmz8Fgnqvov4 Sqjq9huiZIomg3CbtkguCA= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is sooooo funny how this thread has been progressing.  The purpose for TRANCOUNT is for applications to track the state of transactions for a given connection to the database. TRANCOUNT keeps track of open transactions and is intented for usage in MSSQL server since transactions  are handled differently there.  In PG we don't have this "stacked" transactions scenario unit PG 11 where we started to support procedures that can call other procedures and hence we can have a stacked list of open transactions.  But still, TRANCOUNT in PG is basically useless, so when you convert from MS SQL to PG, just throw the damn thing away! Regards, Michael Vitale Thomas Kellerer wrote on 5/29/2021 2:15 PM: > mustafa.pekgoz@forenda.com.tr schrieb am 29.05.2021 um 15:07: >> I have a procedure where they have used @@TRANCOUNT , is there an >> equivalent of @@TRANCOUNT in PostgreSQL? (Except Savepoint) > The equivalent in Postgres is > >    SELECT 1 > > > >