pgsql: Further cleanup of JSON-specific error messages.

Started by Tom Lanealmost 12 years ago4 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Further cleanup of JSON-specific error messages.

Fix an obvious typo in json_build_object()'s complaint about invalid
number of arguments, and make the errhint a bit more sensible too.

Per discussion about how to word the improved hint, change the few places
in the documentation that refer to JSON object field names as "names" to
say "keys" instead, since that's what we've said in the vast majority of
places in the docs. Arguably "name" is more correct, since that's the
terminology used in RFC 7159; but we're stuck with "key" in view of the
naming of json_object_keys() so let's at least be self-consistent.

I adjusted a few code comments to match this as well, and failed to
resist the temptation to clean up some odd whitespace choices in the
same area, as well as a useless duplicate PG_ARGISNULL() check. There's
still quite a bit of code that uses the phrase "field name" in non-user-
visible ways, so I left those usages alone.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/495cadda5ed55f63db9a91d174b6fad0e1816204

Modified Files
--------------
doc/src/sgml/func.sgml | 12 ++++++------
src/backend/utils/adt/json.c | 26 +++++++++-----------------
2 files changed, 15 insertions(+), 23 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#1)
Re: pgsql: Further cleanup of JSON-specific error messages.

Minor typo in error message - missing "an" before "even":

"argument list must have even number of elements"

should be

"argument list must have an even number of elements"

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/pgsql-Further-cleanup-of-JSON-specific-error-messages-tp5814338p5814398.html
Sent from the PostgreSQL - committers mailing list archive at Nabble.com.

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#2)
Re: pgsql: Further cleanup of JSON-specific error messages.

David G Johnston <david.g.johnston@gmail.com> writes:

Minor typo in error message - missing "an" before "even":
"argument list must have even number of elements"
should be
"argument list must have an even number of elements"

I copied that wording from somewhere else in the same file...

We're not terribly consistent on including/omitting articles in primary
error messages, but I think the majority of cases omit them. In this
case, for example, why are you worried about adding "an" there but not
"the" in front of "argument list"?

regards, tom lane

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#4David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#3)
Re: pgsql: Further cleanup of JSON-specific error messages.

On Sunday, August 10, 2014, Tom Lane <tgl@sss.pgh.pa.us> wrote:

David G Johnston <david.g.johnston@gmail.com <javascript:;>> writes:

Minor typo in error message - missing "an" before "even":
"argument list must have even number of elements"
should be
"argument list must have an even number of elements"

I copied that wording from somewhere else in the same file...

We're not terribly consistent on including/omitting articles in primary
error messages, but I think the majority of cases omit them. In this
case, for example, why are you worried about adding "an" there but not
"the" in front of "argument list"?

regards, tom lane

Position, I guess.

I expect sentence fragments so whether it starts with "the" or not doesn't
stand out as much as the missing "an" right in the middle.

I didn't even notice the missing "the" until you pointed it out. My mind
just filled in the missing leading part but it doesn't fill in the gap in
the middle in the same way.

David J.