Skip site navigation (1) Skip section navigation (2)

Re: review: CHECK FUNCTION statement

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: CHECK FUNCTION statement
Date: 2011-11-30 16:39:13
Message-ID: CAFj8pRC6Oc=v55rVMWUxsH-NNg6RHvvP67mFcL8xL07BJnGzhQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2011/11/30 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> 2011/11/30 Alvaro Herrera <alvherre(at)commandprompt(dot)com>:
>>> How about
>>> CHECK (parse, names=off) FUNCTION foobar(a, b, c)
>
>> this syntax is relative consistent with EXPLAIN, is it ok for all?
>
> It seems pretty awkward to me, particularly putting the options before
> the second keyword of the command --- that could bite us if we ever want
> some other flavors of CHECK command.  I prefer Robert's suggestion of a
> WITH clause at the end.

we can provide both versions - as can be fine for people. Is is simple
in parser. I like both variants and I am thinking so much more
important is a API of checker function and behave of CHECK FUNCTION
statement.

Just idea - don't kill me :). Because CHECK FUNCTION  is not
destructive , then complete signature is not necessary, and when
function name is unique, then parameters should be optional - it can
be comfortable for manual work, so just CHECK FUNCTION name; can work.
I see a usage for option - a entering  parameter's values instead
signature. When I started with overloaded functions, sometimes I had a
problem with identification of function that was executed - CHECK
FUNCTION can help

CHECK FUNCTION name(10,20) WITH (values);
Notice: checking function name(int, int, int default 20)

I would to design API of checker function be friendly to direct call.
There was some ideas to design CHECK FUNCTION for possibility to check
all functions in schema or language. It should be, but we have a
inline statement and system catalog, so anybody can write own scripts
per your requests. And It was one point to decision for separate
checker function from validate function.

Regards

Pavel

>
>                        regards, tom lane
>

In response to

Responses

pgsql-hackers by date

Next:From: Merlin MoncureDate: 2011-11-30 16:52:56
Subject: Re: Add minor version to v3 protocol to allow changes without breaking backwards compatibility
Previous:From: Kevin GrittnerDate: 2011-11-30 16:26:09
Subject: Re: Reserved words and delimited identifiers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group