Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 921F4635011 for ; Fri, 24 Jul 2009 15:10:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 14871-07-4 for ; Fri, 24 Jul 2009 18:10:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f202.google.com (mail-px0-f202.google.com [209.85.216.202]) by mail.postgresql.org (Postfix) with ESMTP id DA8A3634736 for ; Fri, 24 Jul 2009 15:10:10 -0300 (ADT) Received: by pxi40 with SMTP id 40so1253124pxi.15 for ; Fri, 24 Jul 2009 11:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=QhHOfM7l8cuAWuFxp9BovBUh/saXbU15vb9uAaVWQdU=; b=pPT0iRkZvYoty47X53gss0ycH+Amqn5HDsmyMgAkeKGGuoDdNbtEfRjSOkXlglJgUy tGLrmA8I/hDzLy4ULipgzmm9AKNTxbHgUEiRj4LwD79yzvA5Z4Hsp51B0dkn/JHfrdH6 lDLe5+x48xcCIO5WRM+o2/h0dDM7LaGmoiIko= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=keiBmpV86c4Vu3EfqgdBd51Cwx7+ZNRbQAM7EUuLWRqu63u40Q+1rDmX/s3cTxmI8z z4aGHH5j8FmT2QnPEPzg8wGEJ7rE//JEn8QyyxqsjhBlTZCGTzBYI1cbzBtnA6BUDCA3 OM9IfC9mJAPzeLR7+8x4/DU3OiZVXOUnCgCeA= Received: by 10.114.122.18 with SMTP id u18mr4833161wac.152.1248459009763; Fri, 24 Jul 2009 11:10:09 -0700 (PDT) Received: from eddie (c-67-182-227-82.hsd1.ut.comcast.net [67.182.227.82]) by mx.google.com with ESMTPS id j26sm6966855waf.63.2009.07.24.11.10.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 24 Jul 2009 11:10:08 -0700 (PDT) Date: Fri, 24 Jul 2009 12:09:56 -0600 From: Joshua Tolley To: Alvaro Herrera Cc: Glenn Maynard , Richard Huxton , pgsql-sql@postgresql.org Subject: Re: Bit by "commands ignored until end of transaction block" again Message-ID: <20090724180956.GC6606@eddie> References: <4A67F5B6.4080409@archonet.com> <20090723064656.GO25450@eddie> <20090724165431.GB15591@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jy6Sn24JjFx/iggw" Content-Disposition: inline In-Reply-To: <20090724165431.GB15591@alvh.no-ip.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.012 tagged_above=-10 required=5 tests=AWL=0.012 X-Spam-Level: X-Archive-Number: 200907/124 X-Sequence-Number: 32865 --jy6Sn24JjFx/iggw Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 24, 2009 at 12:54:31PM -0400, Alvaro Herrera wrote: > Joshua Tolley escribi=F3: >=20 > > Have you tried this? I expect if you give it a shot, you'll find you do= n't > > actually have this problem. Really, everything is always in a transacti= on. If > > you haven't explicitly opened one, PostgreSQL opens one for you before = each > > statement, and issues a COMMIT afterwards (or a ROLLBACK, if your state= ment > > ran into an error). Statements within functions are always executed wit= hin the > > same transaction, so you can issue SAVEPOINT commands anywhere in PL/pg= SQL > > functions without problems, because you're always in a transaction. >=20 > No, actually you can't call SAVEPOINT inside a PL/pgSQL function (or any > SPI user for that matter -- have you tried savepoints in LOLCODE?) > Inside PL/pgSQL the only way to use savepoints is with EXCEPTION blocks. >=20 > You are correct that you're always in a transaction, but in this context > not all transactions are equal :-( >=20 > (The problem, as we found out, is that the function must always have > control at the same level of transaction nestedness in SPI; you can't > just let the user define and release savepoints arbitrarily.) That makes sense -- and although I did try this before sending the email, apparently I didn't try it well enough. :) - Josh / eggyknap --jy6Sn24JjFx/iggw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkpp+PQACgkQRiRfCGf1UMOASgCgo0QXZcq9qRWDtVrNVM9xNluZ NeMAn2cR95U2RSZDxckHoLU65yUYrsx5 =1rMN -----END PGP SIGNATURE----- --jy6Sn24JjFx/iggw--