Re: poll: CHECK TRIGGER?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Peter Eisentraut <peter_e@gmx.net>, Pavel Stehule <pavel.stehule@gmail.com>, Alvaro Herrera <alvherre@commandprompt.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2012-03-09T20:33:31Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > On Fri, Mar 9, 2012 at 3:15 PM, Peter Eisentraut <peter_e@gmx.net> wrote: >> Well, the more I think about it and look at this patch, the more I think >> that this would be complete overkill and possibly quite useless for my >> purposes. I can implement the entire essence of this framework (except >> the plpgsql_checker itself, which is clearly useful) in 10 lines, >> namely: >> >> CREATE OR REPLACE FUNCTION pep8(src text) RETURNS text >> IMMUTABLE >> LANGUAGE plsh >> AS $$ >> #!/bin/bash >> >> pep8 --ignore=W391 <(echo "$1") 2>&1 | sed -r 's/^[^:]*://' >> $$; >> >> SELECT proname, pep8(prosrc) FROM pg_proc WHERE prolang = ANY (SELECT oid FROM pg_language WHERE lanname LIKE '%python%') ORDER BY 1; >> >> I don't know what more one would need. > Well, I agree with you, but Tom disagrees, so that's why we're talking > about it... What Peter's example demonstrates is that you can apply a single checker for a single language without bothering with any common framework. Well, yeah. What I've wanted from this patch from the beginning was a common framework. That is, I want to be able to write something like SELECT check_function(oid) FROM pg_proc WHERE proowner = 'tgl' and have it "just work" for all languages for which I have checkers. You can't get that with a collection of ad-hoc checkers. If we're going to go the ad-hoc route, there seems little reason to be considering a core patch at all. Freestanding checkers could just as well be independent projects. regards, tom lane