Received: from clio.trends.ca (root@clio.trends.ca [209.47.148.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e8BGdO703445 for ; Mon, 11 Sep 2000 12:39:25 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by clio.trends.ca (8.10.2/8.10.2) with ESMTP id e8BG4QZ10488 for ; Mon, 11 Sep 2000 12:04:26 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id MAA14266; Mon, 11 Sep 2000 12:01:34 -0400 (EDT) To: Roberto Mello cc: pgsql-sql@postgresql.org Subject: Re: Isolation and Concurrency in PG functions? In-reply-to: <39BC6759.55DAF82F@cc.usu.edu> References: <39BC6759.55DAF82F@cc.usu.edu> Comments: In-reply-to Roberto Mello message dated "Sun, 10 Sep 2000 23:02:17 -0600" Date: Mon, 11 Sep 2000 12:01:34 -0400 Message-ID: <14263.968688094@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200009/68 Roberto Mello writes: > I am porting some VERY big functions to PG for a data warehousing system > (that is GPL'd BTW) and it seems that the results of one portion of the > function (e.g. a create table or a series of inserts) are invisible to > the other parts which obviously causes the function (and following > functions) to fail and is completely driving me nuts because I see the > results when I do the queries interactively. ?? How are you defining these functions, exactly? In SQL or PLPGSQL functions, successive queries certainly do see each others' results, for example regression=# create table foot (f1 int); CREATE regression=# create function foo(int) returns int as regression-# 'insert into foot values($1); regression'# select count(*) from foot' language 'sql'; CREATE regression=# select foo(1); foo ----- 1 (1 row) regression=# select foo(1); foo ----- 2 (1 row) If you are coding at the C level you may need to call CommandCounterIncrement() between queries. regards, tom lane