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: Peter Eisentraut <peter_e(at)gmx(dot)net>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: CHECK FUNCTION statement
Date: 2011-12-02 18:45:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
>> Also, what kind of report does this generate?
> Good question.  I suspect what Pavel has now will raise errors, but that
> doesn't scale very nicely to checking more than one function, or even to
> finding more than one bug in a single function.

I stop on first error now. Reason is reuse of functionality that can
to mark a critical point (bug) of embedded query in console.

Continuous checking is possible (plpgsql), but there are a few
critical bugs, that does stop. For example - any buggy assign to
record var causes uninitialized variable and any later checks are
affected. This is possible when ASSIGN, FOR SELECT, SELECT INTO
statements are used. It is small part of possible bugs but relative
often pattern. So I didn't worry about it yet.

> My first instinct is to say that it should work like plain EXPLAIN, ie,
> deliver a textual report that we send as if it were a query result.

can be - but EXPLAIN raises exception too, when there some error.
There should be a some possibility to simply identify result. I am not
sure if checking on empty result is good way. A raising exception
should be option. When we return text, then we have to think about
some structured form result - line, position, message. A advance of
exception on first issue is fact, so these questions are solved.

so CHECK can returns lines - like EXPLAIN, but can be nice and helpful
for this moment a GUC - some like check_raises_exception = on|off.
Default should be "off". And I have to think about some FORMAT option.

is it good plan?


>                        regards, tom lane

In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2011-12-02 19:35:32
Subject: Re: Inlining comparators as a performance optimisation
Previous:From: Tom LaneDate: 2011-12-02 16:55:12
Subject: Re: WIP: Join push-down for foreign tables

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