Re: Isolation and Concurrency in PG functions?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Roberto Mello <rmello(at)cc(dot)usu(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Isolation and Concurrency in PG functions?
Date: 2000-09-11 16:01:34
Message-ID: 14263.968688094@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Roberto Mello <rmello(at)cc(dot)usu(dot)edu> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Albert REINER 2000-09-11 16:25:58 Re: Tree structure
Previous Message Lamar Owen 2000-09-11 14:43:11 Re: [SQL] Re: [BUGS] "ORDER BY" issue - is this a bug?