Re: Attaching error cursor position to invalid constant values - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Attaching error cursor position to invalid constant values
Date
Msg-id 87zlmt4ytf.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Attaching error cursor position to invalid constant values  ("Brendan Jurd" <direvus@gmail.com>)
Responses Re: Attaching error cursor position to invalid constant values  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Brendan Jurd" <direvus@gmail.com> writes:

> On Sun, Aug 31, 2008 at 6:18 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'm fooling around with getting the parser to report an error cursor
>> location if input conversion fails for a constant in a SQL command.
> ...
>>
>> This seems like it'd be a pretty useful thing to have in long queries,
>> but in short queries it looks a bit like overkill.  And it affects
>> the expected output of a whole lot of the regression tests.
>
> This is a cool idea, but as you say it's pretty pointless for one-liner queries.
>
> What about implementing some kind of cutoff point for query length.
> As in, "Display the cursor if the query is < $whatever characters
> long"?  I'm thinking most regression test queries would fall well
> below a reasonable value of $whatever.

I don't think it's pointless at all from the server's point of view. The
server doesn't know what kind of tool is being used to view the results. If
it's a gooey tool then the tool will want to know where the error was so it
can highlight it or position the cursor.

Perhaps there could be a psql option to control whether to show the error
position and perhaps that setting could be based on the length of the query or
how many lines are in it but that seems unnecessarily baroque.

It doesn't seem outrageously chatty to me. Better to err on the side of being
too helpful to the user than not helpful enough.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's PostGIS support!


pgsql-hackers by date:

Previous
From: "Brendan Jurd"
Date:
Subject: Re: Attaching error cursor position to invalid constant values
Next
From: KaiGai Kohei
Date:
Subject: Proposal of SE-PostgreSQL patches (for CommitFest:Sep)