Thread

  1. SELECT FOR UPDATE

    Fernando Eduardo Carvalho <feblec@ig.com.br> — 2002-03-12T01:31:32Z

    Any example ?  Or this is select not implemented ?  ( V7.2 ) 
    
    _________________________________________________________
    Oi! Voc quer um iG-mail gratuito?
    Ento clique aqui: http://registro.ig.com.br/censo/igmail
    
    
    
  2. Re: SELECT FOR UPDATE

    Florian Weimer <weimer@cert.uni-stuttgart.de> — 2002-03-12T09:18:55Z

    feblec@ig.com.br writes:
    
    > Any example ?  Or this is select not implemented ?  ( V7.2 ) 
    
    Last time I tried, it was implemented.  It even seems to result in the
    proper serialization.
    
    Why do you think it is not implemented?
    
    -- 
    Florian Weimer 	                  Weimer@CERT.Uni-Stuttgart.DE
    University of Stuttgart           http://CERT.Uni-Stuttgart.DE/people/fw/
    RUS-CERT                          +49-711-685-5973/fax +49-711-685-5898
    
    
  3. Re: SELECT FOR UPDATE

    Andrew G. Hammond <drew@xyzzy.dhs.org> — 2002-03-12T17:46:22Z

    On Mon, Mar 11, 2002 at 10:31:32PM -0300, feblec@ig.com.br wrote:
    > Any example ?  Or this is select not implemented ?  ( V7.2 ) 
    
    It's implemented, and has been for a while.  Here's a trivial example.
    
    BEGIN;
    SELECT * FROM stuff WHERE stuff_id = '1' FOR UPDATE;
    -- row 1 is now locked (exclusive), so we can do what needs doing
    UPDATE stuff SET something = 'whatever' WHERE stuff_id = '1';
    COMMIT;
    
    This is covered in the manual, see
    http://www2.ca.postgresql.org/users-lounge/docs/7.2/postgres/sql-select.html
    
    I don't mind answering newbie questions like this in the appropriate 
    forum (pgsql-novice list for example).  In the future please at least
    check the manual or give it a try before posting. :)
    
    -- 
    Andrew G. Hammond  mailto:drew@xyzzy.dhs.org  http://xyzzy.dhs.org/~drew/
    56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F              613-389-5481 
    5CD3 62B0 254B DEB1 86E0  8959 093E F70A B457 84B1
    "To blow recursion you must first blow recur" -- me