On 22.09.23 02:38, Andy Fan wrote:
create table tb(a jsonb);
insert into tb select '{"a": "foo", "b": 1}';
select cast(a->'a' as numeric) from tb;
ERRCODE_INVALID_PARAMETER_VALUE cannot cast jsonb string to type numeric
the call stack is:
0 in errstart of elog.c:351
1 in errstart_
Hi Chap,
> As to how to redesign the error message is a bit confusing to
> me, it would be good to see the proposal code as well.
>
> The only concern from me is that the new error from newer
> version is not compatible with the older versions, which may matters
> matters or doesn't match, I don'
On 2023-09-21 20:38, Andy Fan wrote:
insert into tb select '{"a": "foo", "b": 1}';
...
select cast(a->'a' as numeric) from tb;
ERRCODE_INVALID_PARAMETER_VALUE cannot cast jsonb string to type
numeric
...
select cast(a->'b' as int2) from tb;
NUMERIC_VALUE_OUT_OF_RANGE smallint out of ra
Hi Peter,
On Wed, Sep 20, 2023 at 4:51 PM Peter Eisentraut
wrote:
> On 18.09.23 18:55, Chapman Flack wrote:
> > It would make me happy if the message could be changed, and maybe
> > ERRCODE_INVALID_PARAMETER_VALUE also changed, perhaps to one of
> > the JSON-specific ones in the 2203x range.
>
>
On 18.09.23 18:55, Chapman Flack wrote:
It would make me happy if the message could be changed, and maybe
ERRCODE_INVALID_PARAMETER_VALUE also changed, perhaps to one of
the JSON-specific ones in the 2203x range.
What is an example of a statement or function call that causes this
error? Then
Hi,
Thanks for raising this issue in a more public way:)
On Tue, Sep 19, 2023 at 12:55 AM Chapman Flack
wrote:
>
> It would make me happy if the message could be changed, and maybe
> ERRCODE_INVALID_PARAMETER_VALUE also changed, perhaps to one of
> the JSON-specific ones in the 2203x range.
>
Hi,
This came up in [0] and opinions besides my own would be welcome.
There is a function cannotCastJsonbValue in jsonb.c, and it throws
errors
of this form:
ERRCODE_INVALID_PARAMETER_VALUE "cannot cast jsonb %1$s to type %2$s"
where %1 is one of the possible JsonbValue types (null, string,