BUG #15260: When saving json object to a json column bigInteger value is saved wrong

Started by PG Bug reporting formalmost 8 years ago4 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 15260
Logged by: Uri Parush
Email address: urip@ensilo.com
PostgreSQL version: 9.6.0
Operating system: windows 10
Description:

Hi, I think I found a bug in PostgreSQL json column type.
I created the next table:
CREATE TABLE public."Dummy"
(
json json
)

And insert the next data:
INSERT INTO public."Dummy"(
json)
VALUES (
'{ "ID": 9059650307334996772}'
);

The data that was saved was incorrect:
{"ID":9059650307334997000}

Looks like PostgreSQL round the number in the insertion.

#2Magnus Hagander
magnus@hagander.net
In reply to: PG Bug reporting form (#1)
Re: BUG #15260: When saving json object to a json column bigInteger value is saved wrong

On Tue, Jul 3, 2018 at 11:13 AM, PG Bug reporting form <
noreply@postgresql.org> wrote:

The following bug has been logged on the website:

Bug reference: 15260
Logged by: Uri Parush
Email address: urip@ensilo.com
PostgreSQL version: 9.6.0
Operating system: windows 10
Description:

Hi, I think I found a bug in PostgreSQL json column type.
I created the next table:
CREATE TABLE public."Dummy"
(
json json
)

And insert the next data:
INSERT INTO public."Dummy"(
json)
VALUES (
'{ "ID": 9059650307334996772}'
);

The data that was saved was incorrect:
{"ID":9059650307334997000}

Looks like PostgreSQL round the number in the insertion.

Doesn't work that way for me -- mine returns the original number. In
particular, the json datatype doesn't do any parsing at all, so it "cannot
happen". jsonb does parsing, but that one also doesn't round it off.

Are you doing this from psql or some other frontend tool? My guess is the
frontend tool is somehow messing with the data for you. If you didn't
already do it in psql, please confirm if you can reproduce it from there.

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#3Uri Parush
urip@ensilo.com
In reply to: Magnus Hagander (#2)
RE: BUG #15260: When saving json object to a json column bigInteger value is saved wrong

I’m using pgAdmin.

I will check it without it now

*From:* Magnus Hagander [mailto:magnus@hagander.net]
*Sent:* Tuesday, July 3, 2018 12:18 PM
*To:* urip@ensilo.com; pgsql-bugs@lists.postgresql.org
*Subject:* Re: BUG #15260: When saving json object to a json column
bigInteger value is saved wrong

On Tue, Jul 3, 2018 at 11:13 AM, PG Bug reporting form <
noreply@postgresql.org> wrote:

The following bug has been logged on the website:

Bug reference: 15260
Logged by: Uri Parush
Email address: urip@ensilo.com
PostgreSQL version: 9.6.0
Operating system: windows 10
Description:

Hi, I think I found a bug in PostgreSQL json column type.
I created the next table:
CREATE TABLE public."Dummy"
(
json json
)

And insert the next data:
INSERT INTO public."Dummy"(
json)
VALUES (
'{ "ID": 9059650307334996772}'
);

The data that was saved was incorrect:
{"ID":9059650307334997000}

Looks like PostgreSQL round the number in the insertion.

Doesn't work that way for me -- mine returns the original number. In
particular, the json datatype doesn't do any parsing at all, so it "cannot
happen". jsonb does parsing, but that one also doesn't round it off.

Are you doing this from psql or some other frontend tool? My guess is the
frontend tool is somehow messing with the data for you. If you didn't
already do it in psql, please confirm if you can reproduce it from there.

--

Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#4Flo Rance
trourance@gmail.com
In reply to: Uri Parush (#3)
Re: BUG #15260: When saving json object to a json column bigInteger value is saved wrong

I can reproduce this bug, at least with pgadmin4 2.1 (View Data -> All
rows).

You should take a look there to see if it has been already reported:
https://redmine.postgresql.org/projects/pgadmin4/issues

Regards,
Flo

On Tue, Jul 3, 2018 at 11:21 AM, Uri Parush <urip@ensilo.com> wrote:

Show quoted text

I’m using pgAdmin.

I will check it without it now

*From:* Magnus Hagander [mailto:magnus@hagander.net]
*Sent:* Tuesday, July 3, 2018 12:18 PM
*To:* urip@ensilo.com; pgsql-bugs@lists.postgresql.org
*Subject:* Re: BUG #15260: When saving json object to a json column
bigInteger value is saved wrong

On Tue, Jul 3, 2018 at 11:13 AM, PG Bug reporting form <
noreply@postgresql.org> wrote:

The following bug has been logged on the website:

Bug reference: 15260
Logged by: Uri Parush
Email address: urip@ensilo.com
PostgreSQL version: 9.6.0
Operating system: windows 10
Description:

Hi, I think I found a bug in PostgreSQL json column type.
I created the next table:
CREATE TABLE public."Dummy"
(
json json
)

And insert the next data:
INSERT INTO public."Dummy"(
json)
VALUES (
'{ "ID": 9059650307334996772}'
);

The data that was saved was incorrect:
{"ID":9059650307334997000}

Looks like PostgreSQL round the number in the insertion.

Doesn't work that way for me -- mine returns the original number. In
particular, the json datatype doesn't do any parsing at all, so it "cannot
happen". jsonb does parsing, but that one also doesn't round it off.

Are you doing this from psql or some other frontend tool? My guess is the
frontend tool is somehow messing with the data for you. If you didn't
already do it in psql, please confirm if you can reproduce it from there.

--

Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

Attachments:

Capture du 2018-07-03 11-36-02.pngimage/png; name="Capture du 2018-07-03 11-36-02.png"Download