From: Tom Lane <tgl@sss.pgh.pa.us>
To: Roberto Mello <rmello@cc.usu.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Isolation and Concurrency in PG functions?
Date: Mon, 11 Sep 2000 12:01:34 -0400
Message-ID: <14263.968688094@sss.pgh.pa.us> (raw)
In-Reply-To: <39BC6759.55DAF82F@cc.usu.edu>
References: <39BC6759.55DAF82F@cc.usu.edu>
Roberto Mello <rmello@cc.usu.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
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-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, rmello@cc.usu.edu
Subject: Re: Isolation and Concurrency in PG functions?
In-Reply-To: <14263.968688094@sss.pgh.pa.us>
References: <39BC6759.55DAF82F@cc.usu.edu> <14263.968688094@sss.pgh.pa.us>
* 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