Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glc35-0001Yi-15 for pgsql-general@arkaria.postgresql.org; Mon, 21 Jan 2019 16:03:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1glc32-000229-GE for pgsql-general@arkaria.postgresql.org; Mon, 21 Jan 2019 16:03:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glc32-000221-4p for pgsql-general@lists.postgresql.org; Mon, 21 Jan 2019 16:03:40 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glc2y-0002HG-Mi for pgsql-general@postgresql.org; Mon, 21 Jan 2019 16:03:38 +0000 Received: from [192.168.127.1] (port=54532 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1glc2u-000Eyi-Pj; Mon, 21 Jan 2019 16:03:32 +0000 Received: from [127.0.0.1] (port=34844 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1glc2u-000JIq-3D; Mon, 21 Jan 2019 16:03:32 +0000 From: Andrew Gierth To: andyterry Cc: pgsql-general@postgresql.org Subject: Re: commit within a procedure loop - cannot commite with subtransaction In-Reply-To: <1548074591211-0.post@n3.nabble.com> (andyterry's message of "Mon, 21 Jan 2019 05:43:11 -0700 (MST)") Message-ID: <87bm4a3sqk.fsf@news-spur.riddles.org.uk> References: <1548074591211-0.post@n3.nabble.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Mon, 21 Jan 2019 16:03:32 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "andyterry" == andyterry writes: andyterry> Hi, andyterry> Using a procedure for the first time to run some processing andyterry> for each row in a table, generating output to a target andyterry> table. The following works without COMMIT the example below andyterry> gives: andyterry> INFO: Error Name:cannot commit while a subtransaction is active andyterry> INFO: Error State:2D000 What client are you using to execute this? Some clients may insert SAVEPOINT statements (which create subtransactions) behind your back (e.g. psql with \set ON_ERROR_ROLLBACK does this) in order to recover from errors without aborting the whole transaction. (turn on log_statement=all in your config, or for the user you're executing this as, and look for the command in the server log) -- Andrew (irc:RhodiumToad)