UserLock oddity with Limit

From: "Rod Taylor" <rbt(at)barchord(dot)com>
To: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: UserLock oddity with Limit
Date: 2001-05-08 14:52:51
Message-ID: 009f01c0d7ce$8e405730$2205010a@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fiddling with userlock stuff for the purposes of setting up an action
queue. Having the lock in the where clause causes the lock code to
actually lock 2 rows, not just the one that is being returned. 0's in
the last section means it could not be locked. This is with 7.1.1.
The function itself is pretty simple, so I'm wondering that the
function isn't being evaluated for 2 rows where only 1 was wanted.

Userlock code is in the contrib. section.

CREATE TABLE testlock (
id SERIAL PRIMARY KEY
);

INSERT INTO testlock DEFAULT VALUES:
INSERT INTO testlock DEFAULT VALUES:
INSERT INTO testlock DEFAULT VALUES:
INSERT INTO testlock DEFAULT VALUES:
INSERT INTO testlock DEFAULT VALUES:

SELECT id FROM testlock WHERE user_write_lock_oid(oid) = '1' LIMIT 1;

-- From another connection

SELECT user_write_lock_oid(oid) FROM testlock;

--
Rod Taylor
BarChord Entertainment Inc.

Attachment Content-Type Size
Taylor, Rod B.vcf text/x-vcard 451 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-05-08 14:58:27 Re: incorrect query result using complex structures (views?)
Previous Message Tom Lane 2001-05-08 14:29:53 Re: Changes needed to build on NetBSD