Thread: Json:- Accepting 'integer' value

Json:- Accepting 'integer' value

From
shaurya jain
Date:
Hi Team,

Postgres Version:- 12.7
Issue:- JSON data type column accepting 'integer' value
Priority:-Minor

Below is the table definition and insert statement, which is working in Postgres however it doesn't work in oracle with check constraint(jj is JSON strict).

postgres=# \d kp
                            Table "public.kp"
 Column |  Type   | Collation | Nullable |            Default
--------+---------+-----------+----------+--------------------------------
 id     | integer |           | not null | nextval('kp_id_seq'::regclass)
 jj     | json    |           |          |

postgres=# insert into kp(jj) values('98');
INSERT 0 1

But while we checking the same thing in Oracle it doesn't accept this. Is it an issue with Postgres data type?
 

--
Thanks and Regards,
Shaurya Jain
Mobile:- +91-8802809405

Re: Json:- Accepting 'integer' value

From
Tom Lane
Date:
shaurya jain <12345shaurya@gmail.com> writes:
> But while we checking the same thing in Oracle it doesn't accept this. Is
> it an issue with Postgres data type?

I'd call it an issue with Oracle.

We follow RFC 7159, which specifies that "bare" scalars (numbers,
strings, booleans) are valid JSON values.  I see though that it
says

   A JSON text is a serialized value.  Note that certain previous
   specifications of JSON constrained a JSON text to be an object or an
   array.

so apparently Oracle is following some obsolete version of the spec.

            regards, tom lane