Re: Change error code for hstore syntax error - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: Change error code for hstore syntax error
Date
Msg-id f052732b-eb7d-16ff-15c0-cc62c119659a@joh.to
Whole thread Raw
In response to Re: Change error code for hstore syntax error  (Sherrylyn Branchaw <sbranchaw@gmail.com>)
Responses Re: Change error code for hstore syntax error  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi Sherrylyn,

On 2016-05-09 19:42, Sherrylyn Branchaw wrote:
> I'm attaching a revised patch; please let me know if there are any other
> issues before I submit to the commitfest.

I think this is mostly good, but these two should be changed:
  errmsg("unexpected end of string: \"%s\"", state->begin)  errmsg("syntax error at position %d: \"%s\"", ...)

Right now, aside from the error code, these two look like they're 
reporting about an error in the SQL statement itself, and not in an 
input value for a type.  I think they should look more like this:
  errmsg("invalid input syntax for type hstore: \"%s\"", string),  errdetail("Unexpected end of input.")

If possible, it might also make sense to provide more information than 
"unexpected end of string".  For example: what character were you 
expecting to find, or what were you scanning?  I didn't look too closely 
what exactly could be done here.  I'll leave that part to you.


.m



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: \timing interval
Next
From: Stephen Frost
Date:
Subject: Re: Remove superuser() checks from pgstattuple