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 1gwV0Z-0004jO-6c for pgsql-general@arkaria.postgresql.org; Wed, 20 Feb 2019 16:46:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gwV0X-0004f2-By for pgsql-general@arkaria.postgresql.org; Wed, 20 Feb 2019 16:46:05 +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 1gwV0W-0004ev-To for pgsql-general@lists.postgresql.org; Wed, 20 Feb 2019 16:46:05 +0000 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwV0U-0002oh-4W for pgsql-general@postgresql.org; Wed, 20 Feb 2019 16:46:03 +0000 Received: by mail-ot1-x336.google.com with SMTP id n8so41223440otl.6 for ; Wed, 20 Feb 2019 08:46:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=K/sDJq1EJIgMzU6hFLiKd04ylv6o4pt39NzXK44VzRs=; b=TH48gwtO5zwaKfaZF4Yk5WIKb3ltpcllt5C0GeTAd2zSdRQ0Kfl4Rg/3wA1YowGTFT 47wDgjyqm03ZYz5WwvP4FgL64iwarvBv4w4B5uaJBRQtC07KdxS0tK5hVb3vbSCPsm1Q vsmMYsNL9ahBWcN5Bia4azb1R3LJKpRAMuNOeSwAm3vZ6ltb36ec/8l9hi2lZLAtR9ps isp891KM+4uuyZZrB82NZWrzl8ysXfWWGrOnbjtem4nvyHkRTi6uArT/LJJvMHiokRRB tgx+TnY4gq9YN+pEhzAYo73AZd01MQbFEmrjfwNZHrgRrC5LaTEBxLwNXbxplkY0/t8p iazA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=K/sDJq1EJIgMzU6hFLiKd04ylv6o4pt39NzXK44VzRs=; b=ss6MUXUSf9Xay+HI0xHLJv9U+hRau/h/Yao/C7PaGEKdPYr0AkFa5rQTe8gz5vMno9 9PFqEJ2zWZDj48UULmf0MExKxwhE8AG0vhdJEKpEVGUSRyvWXDeVDgO0up01rMpoGuCM b5RbAlbiPl9xP7oC9rvYYXwobElkCCKiIfN9HbVa2dlZ5MfKb54hIu1EZqQ+sWHO5xQG upACiwR4drd89tZhGVH1e6lIxI7MJ70KSNLRfXLgrn/kZXzKzMohVNlaDuGiQfly3DNZ EItVcQ7BhC0V8L5FM2wQvzSaeqQPPJAvlTWOSdtiI8o9e+CHOyAjZLqbdJ3vLKlSA1Sx dwyA== X-Gm-Message-State: AHQUAubHjQFmI71WWdO+MltcmkrqCjYBjd6tIVe15LiMmyD1dukqsgQE Q4a6//h9Dtsz0N8tOxQDIw4V1TTZ X-Google-Smtp-Source: AHgI3IYRJ4SQg41ZveidwpQZSJeTQ2UyBaKNEo3E/bxCZIx3vDgL9VrtHGQqHyXArN0CvkTzUUa7+Q== X-Received: by 2002:aca:53c2:: with SMTP id h185mr6656333oib.87.1550681161237; Wed, 20 Feb 2019 08:46:01 -0800 (PST) Received: from [192.168.0.29] ([189.216.189.67]) by smtp.gmail.com with ESMTPSA id o128sm8429890oif.14.2019.02.20.08.45.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Feb 2019 08:46:00 -0800 (PST) From: Rob Nikander Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: procedures and transactions Date: Wed, 20 Feb 2019 10:45:59 -0600 References: <72DE4DF2-7013-4D03-AD28-426BFD1B78A0@gmail.com> <6299b758-7851-0a6d-8bb6-8c2956d03c74@2ndquadrant.com> To: Postgres General In-Reply-To: <6299b758-7851-0a6d-8bb6-8c2956d03c74@2ndquadrant.com> Message-Id: X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Feb 20, 2019, at 10:07 AM, Peter Eisentraut = wrote: >=20 > You can run SET TRANSACTION ISOLATION LEVEL in a procedure. I tried that before but I get this error: create or replace procedure t_test(n integer) as $$ begin set transaction isolation level serializable; raise notice 'current isolation level: %', (select = current_setting('transaction_isolation')); raise notice 'current txid: %', (select txid_current()); end; $$ language plpgsql; mydb=3D# call t_test(1); ERROR: SET TRANSACTION ISOLATION LEVEL must be called before any query CONTEXT: SQL statement "SET transaction isolation level serializable"=