returning value from inside a transaction

Поиск
Список
Период
Сортировка
От Matt
Тема returning value from inside a transaction
Дата
Msg-id 9nmd3b$2ivp$1@news.tht.net
обсуждение исходный текст
Ответы Re: returning value from inside a transaction
Список 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 по дате отправления:

Предыдущее
От: rjb26@hotmail.com
Дата:
Сообщение: Re: Help: Postgres, Java and Extended Characters? Solved
Следующее
От: "Marshall Spight"
Дата:
Сообщение: Re: How to make a REALLY FAST db server?