pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Json:- Accepting 'integer' value
2+ messages / 2 participants
[nested] [flat]

* Json:- Accepting 'integer' value
@ 2021-07-13 18:38  shaurya jain <12345shaurya@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: shaurya jain @ 2021-07-13 18:38 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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
email:- 12345shaurya@gmail.com
*Mobile:- +91-8802809405*
LinkedIn:- https://www.linkedin.com/in/shaurya-jain-74353023

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Json:- Accepting 'integer' value
@ 2021-07-13 19:10  Tom Lane <tgl@sss.pgh.pa.us>
  parent: shaurya jain <12345shaurya@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-07-13 19:10 UTC (permalink / raw)
  To: shaurya jain <12345shaurya@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-07-13 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 18:38 Json:- Accepting 'integer' value shaurya jain <12345shaurya@gmail.com>
2021-07-13 19:10 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox