Re: poll: CHECK TRIGGER?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: poll: CHECK TRIGGER?
Date: 2012-03-09 20:33:31
Message-ID: 5154.1331325211@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Mar 9, 2012 at 3:15 PM, Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-03-09 20:40:31 Re: Is it time for triage on the open patches?
Previous Message Tom Lane 2012-03-09 20:22:50 Re: Is it time for triage on the open patches?