Locks in functions? - Mailing list pgsql-general

From Amir Zicherman
Subject Locks in functions?
Date
Msg-id 27a5b7d1040810155355363f7a@mail.gmail.com
Whole thread Raw
List 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

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Transaction blocks
Next
From: "Liam Lesboch"
Date:
Subject: Re: Replication options?