Closed elbakerino closed 3 years ago
Correct PostgreSQL array parsing is quite difficult. Parsing one dimension int or string is easy, but consider multidimension arrays of complex data types.
You can try SELECT u.user_id, json_agg(array_agg(u.project_id)) as projects
. JSON decoding is quite easy in PHP.
Thanks, yes that works!
But only one _agg
is needed/supported:
SELECT u.user_id, json_agg(u.project_id) as projects
Version: 3.1.2
Bug Description
I'm using Nette\Database to query Postgres DBs, using
array_agg
to group one column in an nestedarray
, but instead it results in astring
and not an already parsed array.Steps To Reproduce
PHP similiar to:
Received:
Expected Behavior
Returning an array like:
Possible Solution
Do i need to activate/implement some serialization and/or can that be added somewhere? Didn't found a hint where to add that, so it automatically converts every array, no matter where I'm using
fetchAll
.