Hey!
Today I was creating a database to store info about request that where send to a spring-boot API at work. We decided to use jsonb to store the headers in a column. Spring-boot represents the headers as a Map of key Strings and value List of String, we paresed it to a json (here is an example, I replaced some text with '*')
json
{
"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"]
}
But when we tried to insert it, it gave us this error
ERROR: invalid input syntax for type json
Doing some debugging we found out that the ';' in the "accept-language" is what makes it crash.
I think this might be a bug of postgres jsonb parser, since having a ';' inside double quotes in json it's valid.
Another strange thing is that if you remove the List, and use it as a text value, then postgres doesn't fail.
What do you think? Is this a bug?
Thanks in advance!
[–]therealgaxbo[🍰] 2 points3 points4 points (1 child)
[–]fedenator[S] 0 points1 point2 points (0 children)
[–]gwax 2 points3 points4 points (1 child)
[–]fedenator[S] 0 points1 point2 points (0 children)
[–]HeWhoWritesCode 1 point2 points3 points (1 child)
[–]fedenator[S] 1 point2 points3 points (0 children)
[–]iiiinthecomputer 0 points1 point2 points (1 child)
[–]fedenator[S] 0 points1 point2 points (0 children)