Table locking.

From: "Michael Richards" <michael(at)fastmail(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Table locking.
Date: 2001-01-11 03:18:41
Message-ID: 3A5D2611.00001D.86746@frodo.searchcanada.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi.

I've always had trouble understanding how to properly deal with the
following case.

I need to run an insert on a table but I don't want any other
transactions to commit the insert before me. Within the logic of the
program, I run a select to see if there is a value there, then the
insert. Between these 2 statements someone could commit one that
causes the insert to fail.

Is there a better way to do this than locking the table in SHARE ROW
EXCLUSIVE MODE and trying to be certain that anything else that may
call an insert there asks for the same type of lock?

-Michael
_________________________________________________________________
http://fastmail.ca/ - Fast Free Web Email for Canadians
>From pgsql-sql-owner(at)postgresql(dot)org Wed Jan 10 23:59:39 2001
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f0B4bBB90828
for <pgsql-sql(at)postgresql(dot)org>; Wed, 10 Jan 2001 23:37:11 -0500 (EST)
(envelope-from pgsql-sql-owner(at)postgresql(dot)org)
Received: from paprika.michvhf.com (adsl-dynamic35-204.detroit.mi.ameritech.net [64.108.244.204] (may be forged))
by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f09FLEB22185
for <pgsql-sql(at)postgresql(dot)org>; Tue, 9 Jan 2001 10:21:14 -0500 (EST)
(envelope-from vev(at)michvhf(dot)com)
Received: (qmail 17781 invoked by uid 1001); 9 Jan 2001 15:21:10 -0000
Date: Tue, 9 Jan 2001 10:21:10 -0500 (EST)
From: Vince Vielhaber <vev(at)michvhf(dot)com>
To: The Hermit Hacker <scrappy(at)hub(dot)org>
cc: Kaare Rasmussen <kar(at)webline(dot)dk>, <pgsql-hackers(at)postgresql(dot)org>,
<pgsql-sql(at)postgresql(dot)org>
Subject: Re: [HACKERS] Re: PostgreSQL web page
In-Reply-To: <Pine(dot)BSF(dot)4(dot)31(dot)0101090857120(dot)21326-100000(at)thelab(dot)hub(dot)org>
Message-ID: <Pine(dot)BSF(dot)4(dot)30(dot)0101091007350(dot)17695-100000(at)paprika(dot)michvhf(dot)com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Archive-Number: 200101/102
X-Sequence-Number: 763

On Tue, 9 Jan 2001, The Hermit Hacker wrote:

> On Tue, 9 Jan 2001, Kaare Rasmussen wrote:
>
> > I wonder why http://www.postgresql.org is not updated with news. The
> > latest "Latest News" is from Nov 16. I have to go to
> > http://www.pgsql.com to find some interesting news later than that:
> > 2000-12-22 PostgreSQL, Inc. Releases Open Source Replication & Database
> > and 2000-12-12 2000 Linux Journal Editor's
> > Choice Award for Best Database
> >
> > In fact I was looking for the Replication server. No mention seems to be
> > available on postgresql.org.
> >
> > Also the mailing list archive for pgsql-sql is not listed here:
> > http://www.postgresql.org/devel-corner/index.html - but you can see it
> > if you write the correct URL yourself.
>
> I have no graphical browser right now, and lynx isn't installed, so I'm a
> bit at a disadvantage here ... but, pgsql-sql *should* be listed under
> users-gallery, not devel ... devel is -hackers, -bugs, -ports, etc ...

Unless the clock on hub was wrong, I have the award happening on
11/16/Y2K. The replication server info was a press release by
PostgreSQL, Inc. Not the PostgreSQL Global Development Group. Between
GB and PG,Inc with the constant barrage of press releases I made the
decision months ago that NO press releases from ANY group would be posted
on the PostgreSQL website - these groups have their own websites for that
and PostgreSQL.org doesn't need to be caught up in the middle.

pgsql-sql is in the users section - both info and archives.

> Beyond that, the web site is maintained by Vince ... but I thought the
> Award was definitely up there already ...

Both on the main page and in latest news.

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev(at)michvhf(dot)com http://www.pop4.net
128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Wagner 2001-01-11 12:34:35 Re: [SQL] connecting to postgres server from Access
Previous Message Justin Clift 2001-01-10 19:08:43 Possible bug? WAS :Bad (null) varchar() external representation.