Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B892564FCE9 for ; Mon, 15 Sep 2008 14:51:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 29601-02 for ; Mon, 15 Sep 2008 14:51:08 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.169]) by postgresql.org (Postfix) with ESMTP id BFDD864FCE7 for ; Mon, 15 Sep 2008 14:51:08 -0300 (ADT) Received: by wf-out-1314.google.com with SMTP id 25so2134090wfc.28 for ; Mon, 15 Sep 2008 10:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=mBHmaxJzgOlgEoOvOBSf88cQqeEJbvwlSUdIe4b3ihs=; b=wUyWnAcux8eP1wFpKsogOyuepk0iuXhKmrrFuPIZDsVQJGQ7Qfgbi82K/S3w3ThDMn 6FrJ/P0Gtc8TjkRaHQU1qNwXxXcMhQPpMdU43bCbDYps5vTuwhbpK0hLicm15zDI7BpF VXQOjlmnzxqNrnqlKysAUJ6F4er/99hH9Dj2I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=CmfFlgxe+uuznhqPn31i6KwuqGUte3I03AeZZV1swPSwIgw9CZXpcICpAc9V9Ek7YL s06DHnIHQ7DrSPmDaxpWQYcL8KMgoFW3zFObm4miwCiPjWN4qWtXnGkG9BRFjslxSGoM 6lFrmaBHirDdU1tVWOIlmjm24nfTsqrqvE9N8= Received: by 10.141.70.18 with SMTP id x18mr4956895rvk.284.1221501067618; Mon, 15 Sep 2008 10:51:07 -0700 (PDT) Received: by 10.141.74.11 with HTTP; Mon, 15 Sep 2008 10:51:07 -0700 (PDT) Message-ID: Date: Mon, 15 Sep 2008 11:51:07 -0600 From: "Scott Marlowe" To: "c k" Subject: Re: Functions Cc: pgsql-general@postgresql.org, pgsql-admin@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/138 X-Sequence-Number: 30231 On Mon, Sep 15, 2008 at 10:55 AM, c k wrote: > Dear PG members, > I want to know that does begin and end in plpgsql are related to begin > transactions and commit? if yes/no how? No. a plpgsql function is a transaction in its entirety. If called within a transaction it inherits the parent transaction. >If I start to execute a function of > multiple statements does PG commits each transaction within a function, or > whole function as a transaction. Whole thing, all or nothing. > Also if first statement makes inserts/updates a row, does it automatically > available to that particular function execution only or to any other > instances of same function? To that function only. Until commit no one else should see the change. > Please give the details. > In my system, function are extensively used and cab called by different > clients as ODBC, JDBC and others. How called isn't all that critical, unless you've set some kind of autocommit flag or something.