Skip site navigation (1) Skip section navigation (2)

Re: Strange situation with two tables.

From: Terry Yapt <yapt(at)technovell(dot)com>
To: olly(at)lfix(dot)co(dot)uk
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Strange situation with two tables.
Date: 2002-09-11 17:20:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Ok, I must to set isolation level to 'serializable' at the function begin, and set isolation level to 'normal mode' at the end.

How can I do it ?


-----Original Message-----
From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Terry Yapt <yapt(at)technovell(dot)com>
Date: 11 Sep 2002 16:09:07 +0100
Subject: Re: [NOVICE] Strange situation with two tables.

On Wed, 2002-09-11 at 15:41, Terry Yapt wrote:
> If I understand you and
> USER1 starts this pl/pgsql body function  
>     BEGIN
>        SELECT count(*) AS c1 FROM debits;
>        ........
>        ........  -- Here USER2 INSERTS a new row in debits table. --
>        ........
>        SELECT count(*) AS c2 FROM debits
>        IF c1 = c2 THEN
>           RETURN true
>        ELSE
>           RETURN false
>        END IF;
>     END;
> This functions returns TRUE ?  It is right ?

If USER2's transaction has been committed, if the isolation level is
'read committed' the function will return false but if the isolation
level is 'serializable' it will return true.

If USER2's transaction is uncommitted, the function will return true
whatever the isolation level.

Oliver Elphick                                Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
     "I am crucified with Christ; nevertheless I live; yet
      not I, but Christ liveth in me; and the life which I
      now live in the flesh I live by the faith of the Son
      of God, who loved me, and gave himself for me."
                                         Galatians 2:20


pgsql-novice by date

Next:From: Roland RobertsDate: 2002-09-11 17:21:28
Subject: Re: Unique indices and nulls
Previous:From: Josh BerkusDate: 2002-09-11 16:23:47
Subject: Re: Unique indices and nulls

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group