Re: review: CHECK FUNCTION statement

From: Petr Jelínek <pjmodos(at)pjmodos(dot)net>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Greg Smith <greg(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Subject: Re: review: CHECK FUNCTION statement
Date: 2012-03-03 13:26:04
Message-ID: 4F521BEC.1090401@pjmodos.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/03/2012 02:24 AM, Alvaro Herrera wrote:
> question: how attached you are to the current return format for CHECK
> FUNCTION?
>
> check function f1();
> CHECK FUNCTION
> -------------------------------------------------------------
> In function: 'f1()'
> error:42804:5:assignment:subscripted object is not an array
> (2 rows)
>
> It seems to me that it'd be trivial to make it look like this instead:
>
> check function f1();
> function | lineno | statement | sqlstate | message | detail | hint | level | position | query
> ---------+--------+------------+----------+------------------------------------+--------+------+-------+----------+-------
> f1() | 5 | assignment | 42804 | subscripted object is not an array | | | error | |
> (1 row)
>
> This looks much nicer to me.
>
> One thing we lose is the caret marking the position of the error -- but
> I'm wondering if that really works well. I didn't test it but from the
> code it looks to me like it'd misbehave if you had a multiline statement.
>
> Opinions?

Well, if you want nicely formated table you can always call the checker
function directly, I think the statement returning something that is
more human and less machine is more consistent approach with the rest of
the utility commands. In other words I don't really see the point of it.

Petr

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-03-03 13:45:10 Re: Command Triggers, patch v11
Previous Message Simon Riggs 2012-03-03 13:14:59 Re: COPY with hints, rebirth