pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Isolation and Concurrency in PG functions?
2+ messages / 2 participants
[nested] [flat]

* Isolation and Concurrency in PG functions?
@ 2000-09-11 05:02 Roberto Mello <rmello@cc.usu.edu>
  2000-09-11 16:01 ` Re: Isolation and Concurrency in PG functions? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Roberto Mello @ 2000-09-11 05:02 UTC (permalink / raw)
  To: pgsql-sql

Hail PG Gurus,

Can somebody please tell us about concurrency in PG functions? 

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.

What can I do about this? Is autocommit off in functions? How can I
bring it on? This becomes worse because transactions are not supported
in functions (anybody knows when will this be around?).

Thanks,

-Roberto Mello

-- 
Roberto Mello, rmello@cc.usu.edu - GNU/Linux Reg.User #96240 
 Computer Science - Utah State University
 USU Free Software and GNU/Linux Club, President
 http://fslc.usu.edu - http://www.brasileiro.net/roberto



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Isolation and Concurrency in PG functions?
  2000-09-11 05:02 Isolation and Concurrency in PG functions? Roberto Mello <rmello@cc.usu.edu>
@ 2000-09-11 16:01 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2000-09-11 16:01 UTC (permalink / raw)
  To: Roberto Mello <rmello@cc.usu.edu>; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-09-11 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-11 05:02 Isolation and Concurrency in PG functions? Roberto Mello <rmello@cc.usu.edu>
2000-09-11 16:01 ` Tom Lane <tgl@sss.pgh.pa.us>

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