Re: Email notification pgAgent - Mailing list pgadmin-hackers

From Jasmin Dizdarevic
Subject Re: Email notification pgAgent
Date
Msg-id AANLkTin-cTLa0NgkbSQd0dnFDW78hcdar4OHTtd0QuSq@mail.gmail.com
Whole thread Raw
In response to Re: Email notification pgAgent  (Dave Page <dpage@pgadmin.org>)
Responses Re: Email notification pgAgent  (Dave Page <dpage@pgadmin.org>)
List pgadmin-hackers
Okay, I'm almost done. Actually there is a problem with building the wxSMTP package, so it doesn't send mails yet. 
If this is done, I'm going to test it on Windows and *nix.

Time to take care about some other things: 

1. I'm coding on Windows with VS 2010. I've downloaded the source files and run cmake to get a VS-Project. Here i made the changes. How I can generate a patch file with git now, because I'm not working on the original source files - because of the cmake step? Have I to redo the changes on *nix?
2. What steps are necessary to send the changes to the community? Is there a desired process and what's about the necessary changes in the pgAdmin UI? Will they be done by the maintainer of pgAdmin? Of course I'm ready to participate in pgAdmin too, but my knowledge of C++ and wx are limited, so I can not promise best quality ;)

:) The 320 characters are wrong, 254 is the maximum. I didn't knew that "text" in this case is more efficient than "varchar(n)".

Jasmin


2010/12/27 Dave Page <dpage@pgadmin.org>
Hi

On Mon, Dec 27, 2010 at 9:46 AM, Jasmin Dizdarevic
> 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

pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: Email notification pgAgent
Next
From: "pgAdmin Trac"
Date:
Subject: [pgAdmin III] #294: Make dialogs read-only on HS slaves