Search Postgresql Archives

How can I set a timeout for a locked table in Function ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



CREATE OR REPLACE FUNCTION public."testlock"()
    RETURNS TABLE
(
id integer,
name character varying,
state integer,
owner character varying
)
    LANGUAGE 'plpgsql'
AS $BODY$
BEGIN
SET  "statement_timeout" = 6000; --- It's not changing. !!
LOCK TABLE public."lock" IN ROW EXCLUSIVE MODE;
UPDATE public."lock" as l set name = 'deneme' WHERE l."id" = 4;

RETURN QUERY
select l."id",l."name",l."state",l."owner" from public."lock" as l, pg_sleep(10) where l."id" = 4;
END;
$BODY$;
select * from public."testlock"(); 
How can I do ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux