Fwd: Re: [ADMIN] Can i write a time-trigger?

Поиск
Список
Период
Сортировка
Искать

Fwd: Re: [ADMIN] Can i write a time-trigger?

От:
Guillaume Lelarge <guillaume@lelarge.info>
Дата:
Wow!  Thanks a lot!  That was a great deal of help! :-)

On Wed, Nov 18, 2009 at 8:41 PM, Jure Kobal <j.kobal@gmx.com> wrote:

> -- While running the pgagent daemon, what dbname should i specify? Is it
> postgres or pgadmin (as the example in
> http://www.enterprisedb.com/docs/en/8.3/tools/pgadmin/1.8.2/pgagent-install
> .html) ?

postgres. Since that is the database, pgagent is only a schema inside it.

The problem is that sites like the above and 

http://www.pgadmin.org/docs/1.8/pgagent-install.html are misleading, giving dbname=pgadmin in their example, while they clearly mention that we should create the pgagent catalogs in the 'postgres' database.  Really careless of them!
 

> -- I managed to create a 'Job' in pgAdmin with the Definition specifying a
> call to my stored proc (without referencing the database).  

How did you manage this? When you select SQL as the type of the step it won't
let you create the step without the database name.

You are right.  I had actually selected the database when creating the step, but i had assumed that to be a 'target' for the step to run on, rather than a reference for the sql. And i had forgotten about it.  Anyways, my mistake.  Sorry!

 
If you wan't to debug it you can run it with "-f" and "-l 2". With that it
will run in foreground(-f) and debug mode(-l 2). That way you can see what
it's doing.

This is amazingly helpful.  More than i had imagined.  Thanks!  What i had initially thought by looking at pgagent --help which claims that with the -l option,  0 is error, 1 is warning, 2 is debug and 0 is default.   So i had thought that any error should be automatically flagged by the process when i run it in foreground (-f).  Including 'database pgadmin does not exist'.  But it didn't.  On further investigation after your suggestion, i found that this is considered only a 'warning' and not an 'error'!  So it is flagged with -l 1 or 2, but not with 0.  Isn't this ridiculous!

So now i know why my job wasn't running! 
And the -l 2 option (debug mode) is really great!  It gives me so many details i'm thrilled!  :-)

Anyways thanks a lot!  Now i'm up and running!  :-)
Thanks,
Shruthi

Re: Fwd: Re: [ADMIN] Can i write a time-trigger?

От:
Dave Page <dpage@pgadmin.org>
Дата:
On Thu, Nov 19, 2009 at 3:57 PM, Guillaume Lelarge
 wrote:
> Hi,
>
> I don't know all the in and out of pgagent, but I think he's right in his
> complaint (unfortunately not in the way he did complain). Should we really
> have "dbname=postgres" instead of "dbname=pgadmin" or am I missing something
> obvious?

Yes, probably. iirc, those docs were written before we had a postgres
database as standard - and we certainly didn't recommend using
template1 which was the old default maintenance DB.

> This is amazingly helpful.  More than i had imagined.  Thanks!  What i had initially
> thought by looking at pgagent --help which claims that with the -l option,  0 is error,
> 1 is warning, 2 is debug and 0 is default.   So i had thought that any error should
> be automatically flagged by the process when i run it in foreground (-f).  Including
> 'database pgadmin does not exist'.  But it didn't.  On further investigation after your
> suggestion, i found that this is considered only a 'warning' and not an 'error'!  So it
> is flagged with -l 1 or 2, but not with 0.  Isn't this ridiculous!

It's a warning because it doesn't cause a hard failure. It'll keep
trying to connect, and then give up with an error after 10 or so
attempts over a period of time. It's done that way to allow for race
conditions in init scripts, or systems where PostgreSQL starts in a
timely fashion, but doesn't come up immediately because it goes into
recovery for example.

> So now i know why my job wasn't running!
> And the -l 2 option (debug mode) is really great!  It gives me so many details i'm thrilled!  :-)

Yeah, you get to see the threaded pooler at work. A simple piece of
code really, but strangely satisfying to finish writing.


-- 
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com

Re: Fwd: Re: [ADMIN] Can i write a time-trigger?

От:
Guillaume Lelarge <guillaume@lelarge.info>
Дата:
Le jeudi 19 novembre 2009 à 08:09:16, Dave Page a écrit :
> On Thu, Nov 19, 2009 at 3:57 PM, Guillaume Lelarge
> 
>  wrote:
> > Hi,
> >
> > I don't know all the in and out of pgagent, but I think he's right in his
> > complaint (unfortunately not in the way he did complain). Should we
> > really have "dbname=postgres" instead of "dbname=pgadmin" or am I missing
> > something obvious?
> 
> Yes, probably. iirc, those docs were written before we had a postgres
> database as standard - and we certainly didn't recommend using
> template1 which was the old default maintenance DB.
> 

Fixed.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
FAQ