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 1oIVBW-0001S0-Tt for pgsql-general@arkaria.postgresql.org; Mon, 01 Aug 2022 13:10:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIVBT-0003Fw-Oa for pgsql-general@arkaria.postgresql.org; Mon, 01 Aug 2022 13:10:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIVBT-0003CE-4U for pgsql-general@lists.postgresql.org; Mon, 01 Aug 2022 13:10:11 +0000 Received: from campbell-lange.net ([178.79.140.51]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIVBM-0003GD-LG for pgsql-general@lists.postgresql.org; Mon, 01 Aug 2022 13:10:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=campbell-lange.net; s=it; h=Content-Type:MIME-Version:Message-ID:Subject:To :From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4cy+fQIEVdKKCpXdKq4viX0YzbKW7PakIajG80sTV7c=; b=qpr6aIGngEiYkN+mzWxBEGK7ae dBv+1i6CfP5ZFCaky1c6pwSAOjLbOSzmhqI8lo6eNAedbTTmkU4SzLcPgf1N/3ltiOksKv+hsIBdL rh04uhVKa+geL55dEShllHp3GG7ele91JfmjpiXPBoG73vEyQRwrHzhHOX7NMAOhD9Bc=; Received: from arennes-651-1-229-47.w90-32.abo.wanadoo.fr ([90.32.108.47] helo=rory-t470s) by campbell-lange.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oIVBJ-00746N-Ha for pgsql-general@lists.postgresql.org; Mon, 01 Aug 2022 13:10:01 +0000 Received: from rory by rory-t470s with local (Exim 4.94.2) (envelope-from ) id 1oIVBI-002FDH-54 for pgsql-general@lists.postgresql.org; Mon, 01 Aug 2022 14:10:00 +0100 Date: Mon, 1 Aug 2022 14:10:00 +0100 From: Rory Campbell-Lange To: pgsql-general@lists.postgresql.org Subject: "set autocommit on" in golang client query Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Apologies for the rather naive question. I have a psql migration script to call a looping procedure which commits batches of data along the following lines: set search_path = a, b c; \set AUTOCOMMIT on -- call procedure with nested transactions CALL c.pr_my_procedure(debug=>true); I'm trying to migrate this to a programme using the golang pgx module to exec this code on a large number of databases in parallel. There doesn't seem an obvious way of setting autocommit outside of psql, so the equivalent of conn.Exec(context.Background(), "set search_path = a, b c; set AUTOCOMMIT on; CALL c.pr_my_procedure(debug=>true);") fails with ERROR: syntax error at or near "ON" while conn.Exec(context.Background(), "set search_path = a, b c; CALL c.pr_my_procedure(debug=>true);") fails with ERROR: invalid transaction termination How should I set autocommit on? The "Create Procedure" docs at https://www.postgresql.org/docs/current/sql-createprocedure.html don't seem to mention autocommit. Rory