Thread: Select query inside function must read commited data

Select query inside function must read commited data

From
"V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Date:
<br />  Dear all ,<br /><br /> Would like to receive your kind attention and enormous knowledge on the following<br
/><br/> I have a function<br /> sai_func_a()<br /> Which does as follows and in the same order:<br /> 1. Retrieves the
latestrecord from the table test_sai<br />    (By latest I mean the record corresponding to max primary key of the
table)<br/> 2. Increments date as received from test_sai.current_date<br />    as my_new_date := test_sai.current_date
+1 ;<br /> 3. Inserts the new date into the same table test_sai<br /> 4. Calls another function sai_func_b()<br />   
Nowinside sai_func_b()<br />    1. Does as #1 of above<br />    2. Works on the date in the last record.<br />    3.
Returnssuccess code to sai_func_a()<br /> 5. The sai_func_a() finishes the work<br /><br /> Now My question :<br />
Sincesai_func_a() which encapsulates the function sai_func_b has not completed yet till #4 or #5<br /> then how does
thefunction sai_func_b reads the new data since it is not committed yet.<br /><br /> If I am not wrong PostgreSQL
selectstatements works on committed data thus the new<br /> inserted data at #3 must not be available to sai_func_b()
till#5<br /><br /> Server Specs:<br /> 1. version<br />
---------------------------------------------------------------------------------------------------------<br/>
PostgreSQL7.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)<br /> 2.Both
functionsare plpgsql and are not triggers<br /><br /><br /><br /> If you need more information kindly ask for the
same.<br/><br /><br /><br /><pre class="moz-signature" cols="72">-- 
 
Regards,
Vishal Kashyap

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
I Know you believe my words so logon to Jabber.org
and add <a class="moz-txt-link-abbreviated" href="mailto:vishalkashyap@jabber.org">vishalkashyap@jabber.org</a> to your
roster.
~*~*~*~*~*~*~*~*
I am usually called as Vishal Kashyap
but my Girlfriend calls me as Vishal CASH UP.
This is because others identify me because of my generosity
but my Girlfriend identify me because of my CASH.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
</pre>