postgresql-for-doctrine icon indicating copy to clipboard operation
postgresql-for-doctrine copied to clipboard

JsonbArray returns malformed result

Open delirehberi opened this issue 5 years ago • 2 comments

I have a field that has jsonb[] type. I want to add multidimensional array data to that field. But PostgreSQL returns an error. I tried to find what is wrong but i couldn't succeed.

You can reproduce with that data:

[
  [ 
    'id'=>5,
    'text'=>'test'
  ]
]

error:

  SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  malformed array literal: "{{"id":5,"test":"test"}}" 
DETAIL:  Unexpected array element.

There is a start point for finding what is wrong: https://dba.stackexchange.com/questions/54283/how-to-turn-json-array-into-postgres-array/54289#54289

delirehberi avatar May 15 '20 14:05 delirehberi

Oh, 🐟 !

The package employs json_encode and json_decode for the transformations and that seems not to be good enough for Postgres.

Can you please confirm when it happens and share complete code for reproducing it?

martin-georgiev avatar Jan 23 '21 23:01 martin-georgiev

Hey @martin-georgiev , actually i can't remember when i got that error. But i'll try to reproduce and share complete code with you as soon as possible.

delirehberi avatar Jan 25 '21 15:01 delirehberi

Closing due to no further reports of this breaking in later versions. Please reopen if you see it happening again.

martin-georgiev avatar Dec 05 '22 01:12 martin-georgiev