Re: poll: CHECK TRIGGER? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: poll: CHECK TRIGGER?
Date
Msg-id 5154.1331325211@sss.pgh.pa.us
Whole thread Raw
In response to Re: poll: CHECK TRIGGER?  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: poll: CHECK TRIGGER?  (Robert Haas <robertmhaas@gmail.com>)
Re: poll: CHECK TRIGGER?  (Peter Eisentraut <peter_e@gmx.net>)
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is it time for triage on the open patches?
Next
From: Dimitri Fontaine
Date:
Subject: Re: Is it time for triage on the open patches?