pgsql: Improve error messages for malformed array input strings.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve error messages for malformed array input strings.
Date: 2014-12-02 23:23:44
Message-ID: E1XvwnI-0001xD-CS@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve error messages for malformed array input strings.

Make the error messages issued by array_in() uniformly follow the style
ERROR: malformed array literal: "actual input string"
DETAIL: specific complaint here
and rewrite many of the specific complaints to be clearer.

The immediate motivation for doing this is a complaint from Josh Berkus
that json_to_record() produced an unintelligible error message when
dealing with an array item, because it tries to feed the JSON-format
array value to array_in(). Really it ought to be smart enough to
perform JSON-to-Postgres array conversion, but that's a future feature
not a bug fix. In the meantime, this change is something we agreed
we could back-patch into 9.4, and it should help de-confuse things a bit.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/7a0be6782b5fc050ec93e386aec13f3100f498a7

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c | 76 +++++++++++++++++++++----------
src/pl/plperl/expected/plperl_array.out | 3 +-
src/test/regress/expected/arrays.out | 6 +++
3 files changed, 60 insertions(+), 25 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2014-12-03 02:44:45 pgsql: Install kludges to fix check-world for src/test/modules
Previous Message Andres Freund 2014-12-02 23:04:21 pgsql: Don't skip SQL backends in logical decoding for visibility compu