X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2D841D1B85F for ; Sun, 25 Jan 2004 08:48:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 36578-02 for ; Sun, 25 Jan 2004 04:47:44 -0400 (AST) Received: from ndl1mr1-a-fixed.sancharnet.in (ndl1mr1-a-fixed.sancharnet.in [61.0.0.45]) by svr1.postgresql.org (Postfix) with ESMTP id 29135D1B7E5 for ; Sun, 25 Jan 2004 04:47:43 -0400 (AST) Received: from conversion-daemon.ndl1mr1-a-fixed.sancharnet.in by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) id <0HS100A01EIG0L@ndl1mr1-a-fixed.sancharnet.in> for pgsql-admin@postgresql.org; Sun, 25 Jan 2004 14:14:02 +0530 (IST) Received: from sancharnet.in ([61.0.95.111]) by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) with ESMTPA id <0HS100EOMEXAYH@ndl1mr1-a-fixed.sancharnet.in> for pgsql-admin@postgresql.org; Sun, 25 Jan 2004 14:14:02 +0530 (IST) Date: Sun, 25 Jan 2004 14:21:03 +0530 From: "V i s h a l Kashyap @ [Sai Hertz And Control Systems]" Subject: Selects query inside function must read commited data To: pgsql-admin@postgresql.org Reply-To: aspire420@hotpop.com Message-id: <40138377.2070503@sancharnet.in> Organization: Sai Hertz And Control Systems MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_a/pHCpUdzRSt/c4/+IovCw)" X-Accept-Language: en-us, en X-Priority: 1 (highest) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=BAYES_20, FROM_ENDS_IN_NUMS, HTML_10_20, PRIORITY_NO_NAME, RCVD_IN_RFCI, USER_AGENT_MOZILLA_UA, X_PRIORITY_HIGH X-Spam-Level: ** X-Archive-Number: 200401/196 X-Sequence-Number: 12059 This is a multi-part message in MIME format. --Boundary_(ID_a/pHCpUdzRSt/c4/+IovCw) Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT 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. ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* --Boundary_(ID_a/pHCpUdzRSt/c4/+IovCw) Content-type: text/html; charset=us-ascii Content-transfer-encoding: 7BIT 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.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
--Boundary_(ID_a/pHCpUdzRSt/c4/+IovCw)--