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

Re: Attaching error cursor position to invalid constant values

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Brendan Jurd" <direvus(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Attaching error cursor position to invalid constant values
Date: 2008-08-31 04:02:04
Message-ID: 87zlmt4ytf.fsf@oxford.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-hackers
"Brendan Jurd" <direvus(at)gmail(dot)com> writes:

> On Sun, Aug 31, 2008 at 6:18 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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!

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2008-08-31 05:13:05
Subject: Re: Attaching error cursor position to invalid constant values
Previous:From: KaiGai KoheiDate: 2008-08-31 03:41:40
Subject: Proposal of SE-PostgreSQL patches (for CommitFest:Sep)

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