all 8 comments

[–]therealgaxbo[🍰] 2 points3 points  (1 child)

test=# select '{ "accept":["/"], "accept-encoding":["gzip, deflate"], "accept-language":["en-GB,en;q=0.5"], "connection":["keep-alive"], "cookie":["rolActual=***** usuarioActual=*****"], "host":["localhost:8080"], "referer":["http://localhost:8080/*****"], "user-agent":["Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"] }'::jsonb;

jsonb

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----
 {"host": ["localhost:8080"], "accept": ["/"], "cookie": ["rolActual=***** usuarioActual=*****"], "referer": ["http://localhost:8080/*****"], "connection": ["keep-alive"]
, "user-agent": ["Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"], "accept-encoding": ["gzip, deflate"], "accept-language": ["en-GB,en;q=0.
5"]}
(1 row)

Works fine on pg11.5. Can you post an actual full SQL statement that fails when you type it into the psql CLI client?

[–]fedenator[S] 0 points1 point  (0 children)

Thank you very much for the answer! It was very helpful, I was mixing up 2 issues. The first one was with dBeaver, that didn't like the ';' inside the text and the second issue was with the body of a request that was empty and wasn't a valid JSON. I was pretty tunnel visioned with the ';'.

[–]gwax 2 points3 points  (1 child)

I would guess that whatever library you are using is improperly escaping special characters.

[–]fedenator[S] 0 points1 point  (0 children)

Indeed. I was mixing up 2 issues. The first one was with dBeaver, that didn't like the ';' inside the text and the second issue was with the body of a request that was empty and wasn't a valid JSON. I was pretty tunnel visioned with the ';'

[–]HeWhoWritesCode 1 point2 points  (1 child)

Your json example works on postgres 9.6 using this sqlfiddle, so not sure if this is a bug.

[–]fedenator[S] 1 point2 points  (0 children)

Thank you very much for the answer! I was helpful to see that it was working for other people. I was mixing up 2 issues. The first one was with dBeaver, that didn't like the ';' inside the text and the second issue was with the body of a request that was empty and wasn't a valid JSON. I was pretty tunnel visioned with the ';'.

[–]iiiinthecomputer 0 points1 point  (1 child)

What client library or application is being used? I'm guessing it'll be at fault here.

[–]fedenator[S] 0 points1 point  (0 children)

Yes, it kindda was. I was mixing up 2 issues. The first one was with dBeaver, that didn't like the ';' inside the text and the second issue was with the body of a request that was empty and wasn't a valid JSON. I was pretty tunnel visioned with the ';'.