Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 07EEDFBD255 for ; Thu, 26 Apr 2012 17:54:00 -0300 (ADT) Received: from gwmta.wicourts.gov ([165.219.244.99] helo=gw.wicourts.gov) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SNVhO-0007vl-AZ for pgsql-docs@postgresql.org; Thu, 26 Apr 2012 20:53:59 +0000 Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Thu, 26 Apr 2012 15:53:45 -0500 Message-Id: <4F996F80020000250004741C@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.2 Date: Thu, 26 Apr 2012 15:53:36 -0500 From: "Kevin Grittner" To: "Marcelo Sena" , Subject: Re: Behaviour of sql language function References: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201204/55 X-Sequence-Number: 7309 Marcelo Sena wrote: > So, is it documented somewhere? http://www.postgresql.org/docs/current/static/tutorial-transactions.html | PostgreSQL actually treats every SQL statement as being executed | within a transaction. If you do not issue a BEGIN command, then | each individual statement has an implicit BEGIN and (if | successful) COMMIT wrapped around it. Combine this with the fact that a function can only run in the context of a command, like: SELECT func_name(); You have your guarantee -- as long as you understand the possible action of subtransactions (like savepoints). -Kevin