| Hi, As long as they 
are on a different connection there should be no problem as currval returns the 
last sequence value that the connection requested, of course if multiple users 
can use a connection through some sort of pooling this wont work. Of course 
nextval will work under these circumstances as well. I am unsure why you 
would want to lock the sequences as this would cause conntention whenever two 
transaction tried to use the sequence (eg for inserts). The following link 
explains a bit about these functions: Cheers, - 
Stuart 
  
  Hi, thanks for this idea. As this reqiures 2 SQL commands, I am 
  worried that there may be some problems if this procedure should be run by a 
  different user inbetween these commands. I would consider transaction locking, 
  however sequences values are not locked. Any ideas on how to secure 
  this?   Thanks Rob Nowik     
    ----- Original Message -----  Sent: Monday, April 14, 2003 4:21 
    PM Subject: RE: [LUG] postgresql 
    inserts 
 You cand 
    o: SELECT 
    currval('sequence_name') as cv; The default 
    sequence names for serial are, IIRC: 
    <table_name>_<column_name>_seq Alternativley 
    you can do a nextval('seq_name') then insert that value (which is the way I 
    prefer). Cheers, - 
    Stuart   
      
      Does postgres have stored procedures or 
      similar? 
        
        Hi,  Not really a linux specific problem, 
        but in postgreSQL i am trying to have an INSERT statement, that 
        has a serial as the only unique 
        identifier. This serial is not set by myself (postgres handles 
        this) but as this is the only unqiue identifier, i need to return it as 
        I do the insert. Any suggestions?     Cheers   Rob 
    Nowik 
 ******************************************************************************
 This 
    email has been virus checked by the Eclipse Internet MAILsafe 
    service
 ******************************************************************************
 www: 
    http://www.eclipse.net.uk/ email: eclipse@xxxxxxxxxxxxxx
 ******************************************************************************
 
 
 DISCLAIMER:The information in this message is confidential and may be legally 
    privileged. It is intended solely for the addressee. Access to this message 
    by anyone else is unauthorised. If you are not the intended recipient, any 
    disclosure, copying, or distribution of the message, or any action or 
    omission taken by you in reliance on it, is prohibited and may be unlawful. 
    Please immediately contact the sender if you have received this message in 
    error. Thank you. 
 
 
 
 DISCLAIMER:The information in this message is confidential and may be legally privileged. It is intended solely for the addressee.  Access to this message by anyone else is unauthorised.  If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful.  Please immediately contact the sender if you have received this message in error. Thank you. 
 
 |