returning value from inside a transaction - Mailing list pgsql-general

From Matt
Subject returning value from inside a transaction
Date
Msg-id 9nmd3b$2ivp$1@news.tht.net
Whole thread Raw
Responses Re: returning value from inside a transaction
List pgsql-general
create table tez (i int);
insert into tez values(3);

create function tezt0(int) returns int as '
begin work;
        lock table tez;
        select * from tez as r;
commit work;

select tez.i;
' language 'sql';

select tezt0(1);
 tezt0
-------
     3
(1 row)

create function tezt1(int) returns timestamp as '
begin work;
        lock table tez;
        select now() as n;
commit work;
select n;
' language 'sql';
ERROR:  Attribute 'n' not found

ok so it's a visibility error in my instance here but how can i get the
value returned from a function inside the transaction

a wrapper like this is the only way I can see to lock tables a 'plpgsql'
function updates.

"Functions and trigger procedures are always executed within a transaction
established by an outer query"

so how on earth do i do this and find out what my functions return!

TIA

Matt








pgsql-general by date:

Previous
From: rjb26@hotmail.com
Date:
Subject: Re: Help: Postgres, Java and Extended Characters? Solved
Next
From: "Marshall Spight"
Date:
Subject: Re: How to make a REALLY FAST db server?