pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: fanlijing <fanlijing@cn.fujitsu.com>
To: 'Albe Laurenz' <laurenz.albe@wien.gv.at>
To: 'fanlijing' <fanlijing@cn.fujitsu.com>
To: pgsql-admin@postgresql.org
Subject: Is there any support like "for update wait N" in PostgreSQL?
Date: Wed, 7 Dec 2011 09:38:57 +0800
Message-ID: <262B52C2DEF844DFB1CB5C81EB02101A@fanlijing> (raw)
In-Reply-To: <19472E8115934C528372F048DEB29E99@fanlijing>
References: <19472E8115934C528372F048DEB29E99@fanlijing>

Hello, Laurenz

 

I'm sorry for replying you so late..

Thank you for your advice below. 

Finally we decide to port it as a shell using the copy command.

 

Actually, now I'm confused with another problem, that is:

Oracle: for update wait 10

PostgreSQL: no support for the parameter "wait"

 

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?

 

I’m waiting for your reply.

Thank you so much any way.

############################################################################

Following is my porting method, although it avoid the dead-lock problem, but
it affect the functionality.

 

SELECT DOMAIN_ID, DOMAIN_NAME...FOR UPDATE WAIT 10 ORDER BY …

->

SELECT DOMAIN_ID, DOMAIN_NAME...ORDER BY … FOR UPDATE

 

 

return (List) queryBean.getQueryRun().query(queryBean.getConn(), strSql, new
String[]{domain_nm,server_flag}, srHandler);

->

Connection conn = queryBean.getConn();

QueryRunner queryRunner = queryBean.getQueryRun();

queryRunner.update(conn, "set statement_timeout = 10000");

return (List) queryRunner.query(conn, strSql, new
String[]{domain_nm,server_flag}, srHandler);

############################################################################

Following is the exception when run my program…

 

11/12/06 15:18:17 ***: APL: INFO : …

….***SqlException: ERROR: canceling statement due to statement timeout
Query: SELECT… ORDER BY … FOR UPDATE Parameters: [yun_SF_18, 0]

        …

        …

11/12/06 15:18:17 ***: APL: ERROR: [ID:flj777] … : !! Exception [class
….***SqlException

        …

        …

]

############################################################################

 

Best Regards!

-----Original Message-----

From: Albe Laurenz [mailto:laurenz.albe@wien.gv.at] 

Sent: Monday, October 10, 2011 10:26 PM

To: Albe Laurenz; fanlijing *EXTERN*; pgsql-admin@postgresql.org;

pgsql-general@postgresql.org

Subject: RE: [GENERAL] how to save a bytea value into a file?

 

I wrote:

[fanlijing wants to write bytea to file]

> A simple

>    COPY (SELECT byteacol WROM mytab WHERE ...) TO 'filename' (FORMAT

binary)

> should do the trick.

 

Corrections:

a) "binary" must be surrounded by single quotes.

b) that won't dump just the binary data - you would have

   to remove the first 25 bytes and the last 2 bytes...

 

So maybe using the functions I mentioned would be the

best way after all.

 

You could also write your own user defined function in C.

 

Yours,

Laurenz Albe

 

view thread (3+ messages)  latest in thread

Message-ID: <262B52C2DEF844DFB1CB5C81EB02101A@fanlijing>
Permalink:  ../262B52C2DEF844DFB1CB5C81EB02101A@fanlijing/
Also on:    postgresql.org/message-id/262B52C2DEF844DFB1CB5C81EB02101A@fanlijing

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: fanlijing@cn.fujitsu.com, laurenz.albe@wien.gv.at
  Subject: Re: Is there any support like "for update wait N" in PostgreSQL?
  In-Reply-To: <262B52C2DEF844DFB1CB5C81EB02101A@fanlijing>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox