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.
BEGIN:VCARD
VERSION:2.1
N:Taylor;Rod;B
FN:Taylor, Rod B
ORG:BarChord Entertainment Inc.;System Operation and Development
TITLE:Chief Technical Officer
ADR;WORK:;;;Toronto;Ontario;;Canada
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:Toronto, Ontario=0D=0ACanada
X-WAB-GENDER:2
URL;WORK:http://www.barchord.com
BDAY:19790401
EMAIL;INTERNET:[EMAIL PROTECTED]
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
EMAIL;INTERNET:[EMAIL PROTECTED]
REV:20010508T145251Z
END:VCARD

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to