Locks in functions?

From: Amir Zicherman <amir(dot)zicherman(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Locks in functions?
Date: 2004-08-10 22:53:33
Message-ID: 27a5b7d1040810155355363f7a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

will locks work inside functions or only in transactions?

will this lock? ....

CREATE OR REPLACE FUNCTION public.sample(varchar)
RETURNS SETOF record AS
'
DECLARE
row RECORD;
BEGIN
LOCK TABLE "URL" IN ROW SHARE MODE;
FOR urlrow in EXECUTE \'SELECT * FROM "table1"\'
LOOP
UPDATE "table1" SET col1=5 WHERE "col2"=6
RETURN NEXT row;
END LOOP;
RETURN;
END;
'
LANGUAGE 'plpgsql' VOLATILE;

thanx, amir

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2004-08-10 22:57:49 Re: Transaction blocks
Previous Message Gaetano Mendola 2004-08-10 22:53:32 Re: Create Table with Foreign Key Error