From: | Sherrylyn Branchaw <sbranchaw(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Change error code for hstore syntax error |
Date: | 2016-03-11 19:33:34 |
Message-ID: | CAB_myF638pgddX4TesZP8W6rGErLK9B+MXUxF_m+sCB_ijaJZQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
hstore_syntax_errcode_V1.diff | text/plain | 6.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-03-11 19:49:06 | Re: Change error code for hstore syntax error |
Previous Message | Tom Lane | 2016-03-11 19:31:00 | Re: [PATH] Correct negative/zero year in to_date/to_timestamp |