Re: Selects query inside function must read commited data - Mailing list pgsql-admin

From Oliver Elphick
Subject Re: Selects query inside function must read commited data
Date
Msg-id 1075047334.1491.16.camel@linda.lfix.co.uk
Whole thread Raw
In response to Selects query inside function must read commited data  ("V i s h a l Kashyap @ [Sai Hertz And Control Systems]" <sank89@sancharnet.in>)
Responses Re: Selects query inside function must read commited data
List pgsql-admin
On Sun, 2004-01-25 at 08:51, V i s h a l Kashyap @ [Sai Hertz And
Control Systems] wrote:
> Since sai_func_a() which encapsulates the function sai_func_b has not
> completed yet till #4 or #5
> then how does the function sai_func_b reads the new data since it is
> not committed yet.
>
> If I am not wrong PostgreSQL select statements works on committed data
> thus the new
> inserted data at #3 must not be available to sai_func_b() till #5

No.  All operations by a single transaction are visible inside the
transaction. Therefore an encapsulated function can see anything already
done in the whole transaction.  A function must be entirely inside a
transaction and cannot start a transaction, so there can never be any
problem about this.

Within a transaction, you cannot see data committed by any _other_
transaction that had not already committed when your transaction
started.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "My little children, let us not love in word, neither
      in tongue; but in deed and in truth."
                                            I John 3:18


pgsql-admin by date:

Previous
From: "V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Date:
Subject: Re: Selects query inside function must read commited data
Next
From: "V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Date:
Subject: Re: Selects query inside function must read commited data