pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Is function atomic?
11+ messages / 4 participants
[nested] [flat]
* Is function atomic?
@ 2001-07-06 16:41 Wei Weng <wweng@kencast.com>
2001-07-06 16:13 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
2001-07-06 16:44 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
0 siblings, 2 replies; 11+ messages in thread
From: Wei Weng @ 2001-07-06 16:41 UTC (permalink / raw)
To: pgsql-sql
If it is not, is it possible to acquire a lock on a row ? how about a
lock on a table?
Thanks a lot!
--
Wei Weng
Network Software Engineer
KenCast Inc.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
@ 2001-07-06 16:13 ` Peter Eisentraut <peter_e@gmx.net>
2001-07-06 17:35 ` Re: Is function atomic? Wei Weng <wweng@kencast.com>
1 sibling, 1 reply; 11+ messages in thread
From: Peter Eisentraut @ 2001-07-06 16:13 UTC (permalink / raw)
To: Wei Weng <wweng@kencast.com>; +Cc: pgsql-sql
Wei Weng writes:
> If it is not, is it possible to acquire a lock on a row ? how about a
> lock on a table?
SQL statements issued by server-side functions operate with the same
transaction isolation semantics as "normal" SQL statements. However,
whatever the function does outside the database may obviously have
different semantics.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:13 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
@ 2001-07-06 17:35 ` Wei Weng <wweng@kencast.com>
2001-07-06 16:49 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 11+ messages in thread
From: Wei Weng @ 2001-07-06 17:35 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql
Does that mean if I used
DECLARE
...
BEGIN
DO_STUFF
END;
the DO_STUFF will not be interrupted (maintain atomicity) even when
multiple threads use the function concurrently?
On 06 Jul 2001 18:13:37 +0200, Peter Eisentraut wrote:
> Wei Weng writes:
>
> > If it is not, is it possible to acquire a lock on a row ? how about a
> > lock on a table?
>
> SQL statements issued by server-side functions operate with the same
> transaction isolation semantics as "normal" SQL statements. However,
> whatever the function does outside the database may obviously have
> different semantics.
>
> --
> Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
>
>
--
Wei Weng
Network Software Engineer
KenCast Inc.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:13 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
2001-07-06 17:35 ` Re: Is function atomic? Wei Weng <wweng@kencast.com>
@ 2001-07-06 16:49 ` Peter Eisentraut <peter_e@gmx.net>
2001-07-06 18:17 ` Re: Is function atomic? Wei Weng <wweng@kencast.com>
0 siblings, 1 reply; 11+ messages in thread
From: Peter Eisentraut @ 2001-07-06 16:49 UTC (permalink / raw)
To: Wei Weng <wweng@kencast.com>; +Cc: pgsql-sql
Wei Weng writes:
> Does that mean if I used
> DECLARE
> ...
> BEGIN
> DO_STUFF
> END;
>
> the DO_STUFF will not be interrupted (maintain atomicity) even when
> multiple threads use the function concurrently?
Interruption, atomicity, and concurrency are separate issues. The
function could of course be interrupted if there's an error. (That error
may be related to concurrency, such as a serialization failure.) The
database interactions of the function will be atomic in the sense that
rollback will work. Concurrent execution of a function is permitted, but
there may be issues if you modify global state or there is a serialization
failure. These are the same issues that you have to deal with in any
programming environment.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:13 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
2001-07-06 17:35 ` Re: Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:49 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
@ 2001-07-06 18:17 ` Wei Weng <wweng@kencast.com>
2001-07-06 17:25 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 11+ messages in thread
From: Wei Weng @ 2001-07-06 18:17 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql
What I wanted is simple:
I don't want other processes that run the function at the same time have
read/write access from the tables this function accesses(select and
insert/update). Is it possible, say, let other proccess blocked on this
function?
On 06 Jul 2001 18:49:49 +0200, Peter Eisentraut wrote:
> Wei Weng writes:
>
> > Does that mean if I used
> > DECLARE
> > ...
> > BEGIN
> > DO_STUFF
> > END;
> >
> > the DO_STUFF will not be interrupted (maintain atomicity) even when
> > multiple threads use the function concurrently?
>
> Interruption, atomicity, and concurrency are separate issues. The
> function could of course be interrupted if there's an error. (That error
> may be related to concurrency, such as a serialization failure.) The
> database interactions of the function will be atomic in the sense that
> rollback will work. Concurrent execution of a function is permitted, but
> there may be issues if you modify global state or there is a serialization
> failure. These are the same issues that you have to deal with in any
> programming environment.
>
> --
> Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>
--
Wei Weng
Network Software Engineer
KenCast Inc.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:13 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
2001-07-06 17:35 ` Re: Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:49 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
2001-07-06 18:17 ` Re: Is function atomic? Wei Weng <wweng@kencast.com>
@ 2001-07-06 17:25 ` Peter Eisentraut <peter_e@gmx.net>
0 siblings, 0 replies; 11+ messages in thread
From: Peter Eisentraut @ 2001-07-06 17:25 UTC (permalink / raw)
To: Wei Weng <wweng@kencast.com>; +Cc: pgsql-sql
Wei Weng writes:
> What I wanted is simple:
> I don't want other processes that run the function at the same time have
> read/write access from the tables this function accesses(select and
> insert/update). Is it possible, say, let other proccess blocked on this
> function?
See LOCK command. But note that this would lock out process in this
function or any other access to these tables. Maybe you should take a
look at the userlock module in contrib.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
@ 2001-07-06 16:44 ` Richard Huxton <dev@archonet.com>
2001-07-06 17:40 ` Re: Is function atomic? John Hasler <john@dhh.gt.org>
1 sibling, 1 reply; 11+ messages in thread
From: Richard Huxton @ 2001-07-06 16:44 UTC (permalink / raw)
To: Wei Weng <wweng@kencast.com>; pgsql-sql
From: "Wei Weng" <wweng@kencast.com>
> If it is not, is it possible to acquire a lock on a row ? how about a
> lock on a table?
All functions take place within a transaction, but since PG doesn't support
nested transactions yet you can't roll back the effects of a nested
function.
- Richard Huxton
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:44 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
@ 2001-07-06 17:40 ` John Hasler <john@dhh.gt.org>
2001-07-07 11:21 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 11+ messages in thread
From: John Hasler @ 2001-07-06 17:40 UTC (permalink / raw)
To: pgsql-sql
Richard Huxton writes:
> All functions take place within a transaction, but since PG doesn't
> support nested transactions yet you can't roll back the effects of a
> nested function.
Do you have any idea when it will?
--
John Hasler
john@dhh.gt.org (John Hasler)
Dancing Horse Hill
Elmwood, WI
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:44 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
2001-07-06 17:40 ` Re: Is function atomic? John Hasler <john@dhh.gt.org>
@ 2001-07-07 11:21 ` Richard Huxton <dev@archonet.com>
2001-07-07 12:27 ` Re: Is function atomic? John Hasler <john@dhh.gt.org>
0 siblings, 1 reply; 11+ messages in thread
From: Richard Huxton @ 2001-07-07 11:21 UTC (permalink / raw)
To: pgsql-sql; John Hasler <john@dhh.gt.org>
From: "John Hasler" <john@dhh.gt.org>
> Richard Huxton writes:
> > All functions take place within a transaction, but since PG doesn't
> > support nested transactions yet you can't roll back the effects of a
> > nested function.
>
> Do you have any idea when it will?
Check the "todo" list in the developers' area on the website - that'll show
what's planned for 7.2
Might be more hands available now though, with the RedHat announcement.
- Richard Huxton
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:44 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
2001-07-06 17:40 ` Re: Is function atomic? John Hasler <john@dhh.gt.org>
2001-07-07 11:21 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
@ 2001-07-07 12:27 ` John Hasler <john@dhh.gt.org>
2001-07-07 13:35 ` Re: Is function atomic? Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 11+ messages in thread
From: John Hasler @ 2001-07-07 12:27 UTC (permalink / raw)
To: pgsql-sql
I wrote:
> Do you have any idea when [nested transactions] will [be added]?
Richard Huxton writes:
> Check the "todo" list in the developers' area on the website - that'll
> show what's planned for 7.2
It's listed there: that's why I asked. Is everything on that list planned
for 7.2?
--
John Hasler
john@dhh.gt.org
Dancing Horse Hill
Elmwood, Wisconsin
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Is function atomic?
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:44 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
2001-07-06 17:40 ` Re: Is function atomic? John Hasler <john@dhh.gt.org>
2001-07-07 11:21 ` Re: Is function atomic? Richard Huxton <dev@archonet.com>
2001-07-07 12:27 ` Re: Is function atomic? John Hasler <john@dhh.gt.org>
@ 2001-07-07 13:35 ` Peter Eisentraut <peter_e@gmx.net>
0 siblings, 0 replies; 11+ messages in thread
From: Peter Eisentraut @ 2001-07-07 13:35 UTC (permalink / raw)
To: John Hasler <john@dhh.gt.org>; +Cc: pgsql-sql
John Hasler writes:
> > Do you have any idea when [nested transactions] will [be added]?
>
> Richard Huxton writes:
> > Check the "todo" list in the developers' area on the website - that'll
> > show what's planned for 7.2
>
> It's listed there: that's why I asked. Is everything on that list planned
> for 7.2?
No. The TODO list is just a list of random ideas, some better than
others. Most seasoned developers have their own private lists of things
that they would like to get done.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2001-07-07 13:35 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-06 16:41 Is function atomic? Wei Weng <wweng@kencast.com>
2001-07-06 16:13 ` Peter Eisentraut <peter_e@gmx.net>
2001-07-06 17:35 ` Wei Weng <wweng@kencast.com>
2001-07-06 16:49 ` Peter Eisentraut <peter_e@gmx.net>
2001-07-06 18:17 ` Wei Weng <wweng@kencast.com>
2001-07-06 17:25 ` Peter Eisentraut <peter_e@gmx.net>
2001-07-06 16:44 ` Richard Huxton <dev@archonet.com>
2001-07-06 17:40 ` John Hasler <john@dhh.gt.org>
2001-07-07 11:21 ` Richard Huxton <dev@archonet.com>
2001-07-07 12:27 ` John Hasler <john@dhh.gt.org>
2001-07-07 13:35 ` Peter Eisentraut <peter_e@gmx.net>
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