Skip site navigation (1) Skip section navigation (2)

Re: Email notification pgAgent

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Jasmin Dizdarevic <jasmin(dot)dizdarevic(at)gmail(dot)com>
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Email notification pgAgent
Date: 2010-12-27 10:46:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgadmin-hackers

On Mon, Dec 27, 2010 at 9:46 AM, Jasmin Dizdarevic
<jasmin(dot)dizdarevic(at)gmail(dot)com> wrote:
> Hi Dave,
> P3 is a good idea.
> I think the best way to configure notifications is on a per job level. So I
> need two fields in the pga_job table:
> alter table pgagent.pga_job add column jobmailnotkind varchar(7) check
> (jobmailnotkind in ('Success','Failure','Both'));

That should probably be:

alter table pgagent.pga_job add column jobmailnotkind char check
(jobmailnotkind in ('s','f','b'));

which more closely matches the existing style - eg. pga_jobstep.jstonerror.

> alter table pgagent.pga_job add column jobmailnotrecp varchar(320);

LOL - where did you get 320 from? :-). Just make that one a "text"
column. It's actually marginally more efficient in PostgreSQL anyway,
because it eliminates the length check that is required by a

> The SMTP server address is going to be an optional cl-argument (-s).
> If this is going into a release.

Seems reasonable.

> Can I assume that the fields are present,
> even if pgagent is compiled without mail notification?

You can handle that by bumping the schema version number in
pgagent.pgagent_schema_version, and the pgAgent major version number
to match. pgAgent should then refuse to run on the older, non-upgraded
schema. Of course, you should also update the two SQL scripts

> Background: I think, it would be inefficient to perform an extra select
> between #ifdef MAIL_NOTIFICATION and #endif,

I don't think you'd do it that way - you'd put the 2 versions of the query in an




block. But... don't bother :-). Just update the schema as noted above.
The reason for making the mail feature optional, is that we don't want
to force a dependency on the wxSMTP package, but that doesn't mean we
need to remove all traces of the mail feature in builds where it's

> Maybe, my questions seems to be silly, sorry for that. It's my first try to
> contribute to an open source project.

No problem at all - we were all first timers once.

Dave Page
Twitter: @pgsnake

EnterpriseDB UK:
The Enterprise PostgreSQL Company

In response to


pgadmin-hackers by date

Next:From: Jasmin DizdarevicDate: 2010-12-28 01:54:18
Subject: Re: Email notification pgAgent
Previous:From: Jasmin DizdarevicDate: 2010-12-27 09:46:05
Subject: Re: Email notification pgAgent

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group