Re: [HACKERS] Sleep functions

2005-08-24 Thread Bruce Momjian
Added to TODO: o Add sleep() to PL/PgSQL --- Robert Treat wrote: On Monday 22 August 2005 11:53, Tom Lane wrote: Robert Treat [EMAIL PROTECTED] writes: On Aug 22, 2005, at 12:40 AM, Michael Fuhr wrote: To

Re: [HACKERS] Sleep functions

2005-08-24 Thread Bruce Momjian
Michael Fuhr wrote: On Wed, Aug 24, 2005 at 12:49:57PM -0400, Bruce Momjian wrote: Added to TODO: o Add sleep() to PL/PgSQL Just to PL/pgSQL? If we're going to add it (which doesn't seem to be decided yet), why not as an ordinary function that could be called from SQL as

Re: [HACKERS] Sleep functions

2005-08-24 Thread Michael Fuhr
On Wed, Aug 24, 2005 at 12:49:57PM -0400, Bruce Momjian wrote: Added to TODO: o Add sleep() to PL/PgSQL Just to PL/pgSQL? If we're going to add it (which doesn't seem to be decided yet), why not as an ordinary function that could be called from SQL as well? -- Michael Fuhr

Re: [HACKERS] Sleep functions

2005-08-22 Thread Dave Page
-Original Message- From: Michael Fuhr[EMAIL PROTECTED] Sent: 22/08/05 05:41:50 To: Tom Lane[EMAIL PROTECTED] Cc: pgsql-hackers@postgresql.orgpgsql-hackers@postgresql.org Subject: Re: [HACKERS] Sleep functions To others who've written their own sleep() function: what are you using

Re: [HACKERS] Sleep functions

2005-08-22 Thread John DeSoi
On Aug 22, 2005, at 12:40 AM, Michael Fuhr wrote: To others who've written their own sleep() function: what are you using it for? I need it for API and user interface testing. I want to be sure things behave correctly when a long running query is interrupted. John DeSoi, Ph.D.

Re: [HACKERS] Sleep functions

2005-08-22 Thread Michael Adler
On Sun, Aug 21, 2005 at 09:13:20PM -0400, Tom Lane wrote: Michael Fuhr [EMAIL PROTECTED] writes: What do people think of exposing pg_usleep() to the user? I'm not real enthused about it. Generally speaking, a sleep() on the database side means you are idling while holding locks, and that

Re: [HACKERS] Sleep functions

2005-08-22 Thread Bruce Momjian
Michael Adler wrote: On Sun, Aug 21, 2005 at 09:13:20PM -0400, Tom Lane wrote: Michael Fuhr [EMAIL PROTECTED] writes: What do people think of exposing pg_usleep() to the user? I'm not real enthused about it. Generally speaking, a sleep() on the database side means you are idling

Re: [HACKERS] Sleep functions

2005-08-22 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 In any case, I wonder how many people, not having a sleep() function, effect a delay with a busy loop; an example of such has been posted in response to the thread in pgsql-admin, and didn't the regression tests do so until recently? That seems

Re: [HACKERS] Sleep functions

2005-08-22 Thread Robert Treat
On Mon, 2005-08-22 at 08:14, John DeSoi wrote: On Aug 22, 2005, at 12:40 AM, Michael Fuhr wrote: To others who've written their own sleep() function: what are you using it for? I need it for API and user interface testing. I want to be sure things behave correctly when a long

Re: [HACKERS] Sleep functions

2005-08-22 Thread Greg Stark
Dave Page dpage@vale-housing.co.uk writes: Sure it's trivial in various languages, even in trusted PL/Tcl: CREATE FUNCTION sleep(integer) RETURNS void AS $$ after [expr $1 * 1000] $$ LANGUAGE pltcl STRICT; Do any of the trusted languages count branches and abort after some large number to

Re: [HACKERS] Sleep functions

2005-08-22 Thread Andrew Dunstan
Greg Stark wrote: Dave Page dpage@vale-housing.co.uk writes: Sure it's trivial in various languages, even in trusted PL/Tcl: CREATE FUNCTION sleep(integer) RETURNS void AS $$ after [expr $1 * 1000] $$ LANGUAGE pltcl STRICT; Do any of the trusted languages count branches and abort

Re: [HACKERS] Sleep functions

2005-08-22 Thread Tom Lane
Robert Treat [EMAIL PROTECTED] writes: On Aug 22, 2005, at 12:40 AM, Michael Fuhr wrote: To others who've written their own sleep() function: what are you using it for? I know I've used one for a script that reindexes various tables on an old 7.3 server. I put a sleep of 20 seconds between

Re: [HACKERS] Sleep functions

2005-08-22 Thread Robert Treat
On Monday 22 August 2005 11:53, Tom Lane wrote: Robert Treat [EMAIL PROTECTED] writes: On Aug 22, 2005, at 12:40 AM, Michael Fuhr wrote: To others who've written their own sleep() function: what are you using it for? I know I've used one for a script that reindexes various tables on an

Re: [HACKERS] Sleep functions

2005-08-22 Thread Jim C. Nasby
On Mon, Aug 22, 2005 at 11:53:22AM -0400, Tom Lane wrote: Robert Treat [EMAIL PROTECTED] writes: On Aug 22, 2005, at 12:40 AM, Michael Fuhr wrote: To others who've written their own sleep() function: what are you using it for? I know I've used one for a script that reindexes various

[HACKERS] Sleep functions

2005-08-21 Thread Michael Fuhr
What do people think of exposing pg_usleep() to the user? It's sometimes useful to have a server-side sleep function, and people do ask about it occasionally (e.g., Don Drake today in pgsql-admin). It's easy enough to do in PL/Perl, PL/Tcl, etc., but since the backend already has pg_usleep(), is

Re: [HACKERS] Sleep functions

2005-08-21 Thread Andrew Dunstan
Michael Fuhr wrote: What do people think of exposing pg_usleep() to the user? It's sometimes useful to have a server-side sleep function, and people do ask about it occasionally (e.g., Don Drake today in pgsql-admin). It's easy enough to do in PL/Perl, PL/Tcl, etc., but since the backend

Re: [HACKERS] Sleep functions

2005-08-21 Thread Dave Page
-Original Message- From: Michael Fuhr[EMAIL PROTECTED] Sent: 21/08/05 23:53:50 To: [EMAIL PROTECTED][EMAIL PROTECTED] Subject: [HACKERS] Sleep functions What do people think of exposing pg_usleep() to the user? Good idea - I've done so myself in the past for testing. Regards, Dave

Re: [HACKERS] Sleep functions

2005-08-21 Thread Tom Lane
Michael Fuhr [EMAIL PROTECTED] writes: What do people think of exposing pg_usleep() to the user? I'm not real enthused about it. Generally speaking, a sleep() on the database side means you are idling while holding locks, and that does not seem like something we want to encourage people to do.

Re: [HACKERS] Sleep functions

2005-08-21 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 As other responders noted, it's trivial to program this in any of the untrusted PL languages, Or in (trusted) plperl - see my post on admin. I would have been a big fan of a sleep function once, for use in plpgsql, but since I now have

Re: [HACKERS] Sleep functions

2005-08-21 Thread Michael Fuhr
On Sun, Aug 21, 2005 at 09:13:20PM -0400, Tom Lane wrote: Michael Fuhr [EMAIL PROTECTED] writes: What do people think of exposing pg_usleep() to the user? I'm not real enthused about it. Generally speaking, a sleep() on the database side means you are idling while holding locks, and that