| From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: returning value from inside a transaction |
| Date: | 2001-09-14 20:00:02 |
| Message-ID: | Pine.BSF.4.21.0109141250110.43495-100000@megazone23.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, 12 Sep 2001, Matt wrote:
> 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';
It looks to me from testing reasonably recent sources
that the above really isn't safe. Since we don't have nested
transactions, that's not a separate transaction from whatever
it's running in, but instead the begin will NOTICE if you're in a
transaction and the commit will commit it and now you're no longer
in a transaction...
begin;
select tezt0(4);
insert into tez values (4);
rollback;
will end up with tez getting the row and a notice about the fact
you weren't in a transaction from rollback. Is this really reasonable
behavior?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | T.R.Missner | 2001-09-14 20:05:18 | how to speed query |
| Previous Message | Oliver Elphick | 2001-09-14 19:49:24 | Re: query help |