1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Improve error messages in ltree_in and lquery_in.

Ensure that the type name is mentioned in all cases (bare "syntax error"
isn't that helpful).  Avoid using the term "level", since that's not
used in the documentation.  Phrase error position reports as "at
character N" not "in position N"; the latter seems ambiguous, and it's
certainly not how we say it elsewhere.  For the same reason, make the
character position values be 1-based not 0-based.  Provide a position
in more cases.  (I continued to leave that out of messages complaining
about end-of-input, where it seemed pointless, as well as messages
complaining about overall input complexity, where fingering any one part
of the input would be arbitrary.)

Discussion: https://postgr.es/m/15582.1585529626@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2020-03-31 10:30:59 -04:00
parent 02a5786df2
commit e07e2a40bd
4 changed files with 63 additions and 52 deletions

View File

@ -38,6 +38,6 @@ $$;
-- because it will try to parse the Python list as an ltree input
-- string.
SELECT test2();
ERROR: syntax error at position 0
ERROR: ltree syntax error at character 1
CONTEXT: while creating return value
PL/Python function "test2"