Re: Functions

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "c k" <shreeseva(dot)learning(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: Functions
Date: 2008-09-15 17:51:07
Message-ID: dcc563d10809151051r79447b28m7468880a55b0a1fa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

On Mon, Sep 15, 2008 at 10:55 AM, c k <shreeseva(dot)learning(at)gmail(dot)com> 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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message c k 2008-09-15 17:53:09 Re: [GENERAL] Functions
Previous Message mkrist 2008-09-15 17:41:37 Re: Trouble setting up access privileges

Browse pgsql-general by date

  From Date Subject
Next Message c k 2008-09-15 17:53:09 Re: [GENERAL] Functions
Previous Message Pedro Doria Meunier 2008-09-15 17:49:02 Re: Oracle and Postgresql