How to mark a transaction as SERIALIZABLE?

Поиск
Список
Период
Сортировка
От Joe Carr
Тема How to mark a transaction as SERIALIZABLE?
Дата
Msg-id AANLkTikHGht_eA-fdKLiTRNVoMOVDeNwFni9mqB=c=Jd@mail.gmail.com
обсуждение исходный текст
Ответы Re: How to mark a transaction as SERIALIZABLE?  (Thom Brown <thom@linux.com>)
Список pgsql-novice
In version 9.0, I've been reading http://www.postgresql.org/docs/9.0/interactive/sql-begin.html. I've been using the following  : 

CREATE OR REPLACE FUNCTION test(character varying)
  RETURNS SETOF integer AS
$BODY$

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; 
--SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; 
RETURN 1;
END;
 $BODY$
  LANGUAGE plpgsql VOLATILE

which returns with the error : 
ERROR:  syntax error at or near "TRANSACTION"
LINE 1: TRANSACTION ISOLATION LEVEL SERIALIZABLE

if the BEGIN line is empty with no semi-colon, the function will work :
CREATE OR REPLACE FUNCTION test(character varying)
  RETURNS integer AS
$BODY$

BEGIN 
--TRANSACTION ISOLATION LEVEL SERIALIZABLE; 
--SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; 

RETURN 1;
END;
 $BODY$
  LANGUAGE plpgsql VOLATILE

but if I place a semi-colon after BEGIN (e.g. BEGIN;), I get the error :
ERROR:  syntax error at or near ";"
LINE 5: BEGIN; 

So any help you may be able to provide in the BEGIN syntax (or whatever I'm doing wrong) is greatly appreciated. Thanks!

   -Joe

В списке pgsql-novice по дате отправления:

Предыдущее
От: Yogesh Sharma
Дата:
Сообщение: Re: SELECT triggers - Table Partitioning
Следующее
От: Thom Brown
Дата:
Сообщение: Re: How to mark a transaction as SERIALIZABLE?