|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-24 08:27 UTC] yohgaki@php.net
-Package: PostgreSQL related
+Package: PDO related
[2013-10-24 10:26 UTC] aaatoja at o2 dot pl
-Status: Open
+Status: Closed
[2013-10-24 10:26 UTC] aaatoja at o2 dot pl
[2013-10-24 10:39 UTC] yohgaki@php.net
-Assigned To:
+Assigned To: yohgaki
[2013-10-24 10:39 UTC] yohgaki@php.net
[2013-10-26 05:40 UTC] aaatoja at o2 dot pl
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 10:00:01 2025 UTC |
Description: ------------ I have a Postgresql (v9.3) view which contains column made from json_agg() function (array_agg works fine). My response looks like: array(5) { [0] => array(2) { ["aggcolumn"] => NULL [0] => NULL } [1] => array(2) { ["aggcolumn"] => string(14) "["test"]]" [0] => string(14) "["test"]]" } [2] => array(2) { ["aggcolumn"] => string(34) "["test", "test2"]]]" [0] => string(34) "["test", "test2"]]]" } [3] => array(2) { ["aggcolumn"] => string(26) "["test3"]]]]" [0] => string(26) "["test3"]]]]" } [4] => array(2) { ["aggcolumn"] => string(46) "["test2", "test3"]]]]]" [0] => string(46) "["test2", "test3"]]]]]" } } Test script: --------------- try { $dbh = new PDO($dsn, $user, $password); $sth = $dbh->prepare('SELECT aggcolumn FROM view_test WHERE company_id = ? AND active_flag IS TRUE'); $sth->execute(array(10)); $res = $sth->fetchAll(); var_dump($res); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); } Expected result: ---------------- Response should be valid JSON string. Actual result: -------------- As You may notice every row has a value with an extra ']' at the end, based on current iteration count. That makes string invalid JSON response