Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> Having said that, I'm a bit concerned about the case where an overly
> long string is given there. However, considering that we already have
> "invalid input syntax for type xxx: %x" messages (including for the
> numeric), this concern might be unnecessary.
Yeah, we have not worried about that in the past.
> Another concern is that the input value is already a numeric, not a
> string. This situation occurs when the input is NaN of +-Inf. Although
> numeric_out could be used, it might cause another error. Therefore,
> simply writing out as "argument NaN and Infinity.." would be better.
Oh! I'd assumed that we were discussing a string that we'd failed to
convert to numeric. If the input is already numeric, then either
the error is unreachable or what we're really doing is rejecting
special values such as NaN on policy grounds. I would ask first
if that policy is sane at all. (I'd lean to "not" --- if we allow
it in the input JSON, why not in the output?) If it is sane, the
error message needs to be far more specific.
regards, tom lane