Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 892C8AB5950 for ; Thu, 8 Dec 2011 23:17:46 -0400 (AST) Received: from [222.73.24.84] (helo=song.cn.fujitsu.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RYqxz-0007W8-Sm for pgsql-admin@postgresql.org; Fri, 09 Dec 2011 03:17:45 +0000 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 13805170132; Fri, 9 Dec 2011 11:17:16 +0800 (CST) Received: from jfttmail.jftt.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id pB93HEIc002356; Fri, 9 Dec 2011 11:17:15 +0800 Received: from fanlijing (unknown [10.167.14.111]) by jfttmail.jftt.cn.fujitsu.com (Postfix) with ESMTP id BDF79822B; Fri, 9 Dec 2011 11:19:20 +0800 (CST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.4.0 Received: from fanlijing[10.167.14.111] by fanlijing (FujitsuOutboundMailChecker v1.4.0/9992[10.167.14.111]); Fri, 09 Dec 2011 11:17:48 +0800 (JST) From: "fanlijing" To: "'Albe Laurenz'" , References: <19472E8115934C528372F048DEB29E99@fanlijing> <262B52C2DEF844DFB1CB5C81EB02101A@fanlijing> Subject: Re: Is there any support like "for update wait N" in PostgreSQL? Date: Fri, 9 Dec 2011 11:17:36 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 Thread-Index: AcyGWZEyayt1FUq5R0q6Cy1384894wAw3tOgAABa7SAABrDHEAAHteQwC+AYzPAAltXn4AEfiIZQAeTxh3A= X-Host-Lookup-Failed: Reverse DNS lookup failed for 222.73.24.84 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201112/62 X-Sequence-Number: 38820 Hello Laurenz Thank you for your rapid reply. Using statement_timeout is indeed the only-way to get a similar functionality as "for update wait N" in oracle. It doesn't affect the functionality at all. As I said in the previous mail that this porting method affects the functionality, it is finally verified as a bug in my program. In a work, the porting method has no problem. Sorry for interrupting you so many times. Best Regards from a Chinese girl~ (*^__^*)=20 Yours, Fan LiJing=A3=A8=B7=B6=C0=F6=DD=BC=A3=A9 2011-12-9 -----Original Message----- From: Albe Laurenz [mailto:laurenz.albe@wien.gv.at]=20 Sent: Wednesday, December 07, 2011 4:08 PM To: fanlijing *EXTERN*; pgsql-admin@postgresql.org Subject: RE: Is there any support like "for update wait N" in = PostgreSQL? fanlijing wrote: > Actually, now I'm confused with another problem, that is: > Oracle: for update wait 10 > PostgreSQL: no support for the parameter "wait" >=20 > What should I do when I'm doing porting on this point? > If I get rid of the parameter "wait", there would be a dead lock in my program... > Is there any support like "for update wait N" in PostgreSQL? >=20 > I'm waiting for your reply. >=20 > Thank you so much any way. >=20 > ######################################################################## #### >=20 > Following is my porting method, although it avoid the dead-lock problem, but it affect the > functionality. >=20 > SELECT DOMAIN_ID, DOMAIN_NAME...FOR UPDATE WAIT 10 ORDER BY ... > -> > SELECT DOMAIN_ID, DOMAIN_NAME...ORDER BY ... FOR UPDATE [...] > queryRunner.update(conn, "set statement_timeout =3D 10000"); [...] > Following is the exception when run my program... [...] > ....***SqlException: ERROR: canceling statement due to statement timeout Query: SELECT... ORDER BY ... FOR > UPDATE Parameters: [yun_SF_18, 0] There is no "WAIT n" clause in PostgreSQL, and using statement_timeout as you did is the only way to get a similar functionality. But you seem unhappy with this approach. How does it affect the functionality? If you use "WAIT n" in Oracle, you will get an error message (ORA-30006) similar to using statement_timeout in PostgreSQL. Yours, Laurenz Albe