Re: proposal: new contrib module plpgsql's embeded sql validator

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Petr Jelínek <pjmodos(at)pjmodos(dot)net>
Cc: Jim Nasby <jim(at)nasby(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: new contrib module plpgsql's embeded sql validator
Date: 2011-07-19 19:42:33
Message-ID: CAFj8pRChdnwAqXxuqAYVp48sWx401m2h3eLZaTqp3wkE5+=evg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dne 19. července 2011 21:15 Petr Jelínek <pjmodos(at)pjmodos(dot)net> napsal(a):
> On 07/17/2011 10:31 PM, Jim Nasby wrote:
>>
>> On Jul 7, 2011, at 11:31 PM, Pavel Stehule wrote:
>>>
>>> a lazy deep SQL validation inside plpgsq functions is interesting
>>> attribute. It allows to work with temporary tables and it make testing
>>> and debugging harder, because lot of errors in embedded queries are
>>> detected too late. I wrote a simple module that can to help little
>>> bit. It is based on plpgsql plugin API and it ensures a deep
>>> validation of embedded sql early - after start of execution. I am
>>> thinking, so this plugin is really useful and it is example of plpgsql
>>> pluging - that is missing in contrib.
>>
>> I think this should at least be a contrib module; it seems very useful.
>>
>
> Yes I agree this should be part of pg distribution.
>
> But, I think we should add valitation hook to plpgsql plugin structure so
> that you don't have to actually execute the function to check it - curretly
> there are only executing hooks which is why the plugin only works when you
> the func (not good for automation).
>

should be great, but there are still few limits in compile time

* polymorphic parameters
* triggers - there are no a info about relation in compile time

we can adapt a #option keyword for using in some plpgsql plugins

for example - for addition information that are necessary for usage of
lint in compilation time

CREATE OR REPLACE FUNCTION foo ()
RETURNS ... AS $$

#option trigger_relation some_table_name
#option replace_anyelement integer

...

with this addition info it and some compile hook it is possible

Regards

Pavel

> --
> Petr Jelinek
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-07-19 19:49:26 Re: [COMMITTERS] pgsql: Remove O(N^2) performance issue with multiple SAVEPOINTs.
Previous Message Gurjeet Singh 2011-07-19 19:17:19 A few user-level questions on Streaming Replication and pg_upgrade