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

From Sherrylyn Branchaw
Subject Change error code for hstore syntax error
Date
Msg-id CAB_myF638pgddX4TesZP8W6rGErLK9B+MXUxF_m+sCB_ijaJZQ@mail.gmail.com
Whole thread Raw
Responses Re: Change error code for hstore syntax error
List pgsql-hackers
The hstore module uses elog() to default to ERRCODE_INTERNAL_ERROR (SQLSTATE XX000) when the error message reads "Syntax error near '%c' at position %d".

I propose to switch to ereport() to return ERRCODE_SYNTAX_ERROR (SQLSTATE 42601), on the grounds that it's more transparent. It took me longer to figure out what error code was being returned than to write both the patch and my originally intended function using the patch.

I also propose to raise the same error code for "Unexpected end of string" in hstore, since it serves the same purpose, at least in my mind: differentiating between valid and invalid hstore syntax. 

Any objections to my submitting the attached patch to the September commitfest?
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATH] Correct negative/zero year in to_date/to_timestamp
Next
From: Tom Lane
Date:
Subject: Re: Change error code for hstore syntax error