pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: V i s h a l Kashyap @ [Sai Hertz And Control Systems] <sank89@sancharnet.in>
To: pgsql-admin@postgresql.org
Subject: Selects query inside function must read commited data
Date: Sun, 25 Jan 2004 14:21:03 +0530
Message-ID: <40138377.2070503@sancharnet.in> (raw)

Dear all ,

Would like to receive your kind attention and enormous knowledge on the 
following

I have a function
sai_func_a()
Which does as follows and in the same order:
1. Retrieves the latest record from the table test_sai
   (By latest I mean the record corresponding to max primary key of the 
table)
2. Increments date as received from test_sai.current_date
   as my_new_date := test_sai.current_date + 1 ;
3. Inserts the new date into the same table test_sai
4. Calls another function sai_func_b()
   Now inside sai_func_b()
   1. Does as #1 of above
   2. Works on the date in the last record.
   3. Returns success code to sai_func_a()
5. The sai_func_a() finishes the work

Now My question :
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

Server Specs:
1. version
---------------------------------------------------------------------------------------------------------
PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 
20030222 (Red Hat Linux 3.2.2-5)
2.Both functions are plpgsql and are not triggers



If you need more information kindly ask for the same.


-- 
Regards,
Vishal Kashyap

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
I Know you believe my words so logon to Jabber.org
and add vishalkashyap@jabber.org to your roster.
~*~*~*~*~*~*~*~*
I am usually called as Vishal Kashyap
but my Girl friend calls me as Vishal CASH UP.
This is because others know me because of my generosity
and my Girlfriend knows me because of my CASH.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

view thread (7+ messages)  latest in thread

Message-ID: <40138377.2070503@sancharnet.in>
Permalink:  ../40138377.2070503@sancharnet.in/
Also on:    postgresql.org/message-id/40138377.2070503@sancharnet.in

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: sank89@sancharnet.in
  Subject: Re: Selects query inside function must read commited data
  In-Reply-To: <40138377.2070503@sancharnet.in>
  References: <40138377.2070503@sancharnet.in>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox