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: AANLkTi=yLSGYTXCdjAWXW_XWYVvYOAoxam5YugU-pUwC@mail.gmail.com (view raw or flat)
Thread:
Lists: pgadmin-hackers
Hi

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
varchar(n).

> 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
accordingly.

> 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

#ifdef MAIL_NOTIFICATION

#else

#endif

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
disabled.

> 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
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

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-2014 The PostgreSQL Global Development Group