X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B85459DCB32 for ; Tue, 20 Dec 2005 17:47:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74300-06 for ; Tue, 20 Dec 2005 17:47:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 172309DCB1A for ; Tue, 20 Dec 2005 17:47:01 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jBKLkxel006568; Tue, 20 Dec 2005 16:46:59 -0500 (EST) To: jmadm@montevideo.com.uy cc: pgsql-interfaces@postgresql.org Subject: Re: Cursors for update.., we have to port an informix 9.x appication using cursors for update In-reply-to: <43A85FA9.3060607@montevideo.com.uy> References: <43A85FA9.3060607@montevideo.com.uy> Comments: In-reply-to jmadm message dated "Tue, 20 Dec 2005 17:46:49 -0200" Date: Tue, 20 Dec 2005 16:46:59 -0500 Message-ID: <6567.1135115219@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.024 required=5 tests=[AWL=0.024] X-Spam-Score: 0.024 X-Spam-Level: X-Archive-Number: 200512/34 X-Sequence-Number: 5902 jmadm writes: > We have to port an application from Informix 9 CSQL to Postgres 8.1 > using Ecpg. > Informix application uses cursors for update to lock all the rows > involved in those cursor. Then an update my occur ussing Current of. > How we can do this with postgres? You can use SELECT FOR UPDATE in the cursor, I think. We don't support WHERE CURRENT OF, so you'll need an alternative strategy for identifying the row in the UPDATE command; you could use the table's primary key, or CTID if you don't mind being quite Postgres-specific. regards, tom lane