Closed guptamo closed 5 years ago
Note that I haven't declared the column as a jsonb[][] because internally for postgres it should be treated the same.
Really…? I think you do need to declare it as a jsonb[][]
if that’s what you want.
I think the documentation says otherwise. There are a lot of tools that actually depend on this behaviour as well such as PGAdmin. It won't even let you declare a column as jsonb[][] unless you over ride their gui and write a SQL query to declare the column type as such.
So is the current implementation the expected behaviour?
https://www.postgresql.org/docs/10/static/arrays.html#ARRAYS-DECLARATION
I have a column defined as a jsonb[] type. I'm actually going to store 2D arrays of JSON objects like the following.
The data representation of this on the database is like this...
{{"{\"type\": \"king\", \"count\": 2}","{\"type\": \"queen\", \"count\": 3}"},{"{\"type\": \"king\", \"count\": 2}","{\"type\": \"queen\", \"count\": 3}"}}
When trying to retrieve this kind of data structure from the database however I end up getting the following error.
I believe this might be because it's ambiguous as to whether or not the curly braces are for an object or an array. Note that I haven't declared the column as a jsonb[][] because internally for postgres it should be treated the same.
Is there any fix for this?