php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59831 pdo_pgsql doesn't understand the new bytea output hex for postgresql 9x
Submitted: 2011-06-28 07:42 UTC Modified: 2013-06-01 19:10 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: brunofr at ioda dot net Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5_3 SVN-2011-06-28 (dev) OS: All (linux/Windows)
Private report: No CVE-ID: None
 [2011-06-28 07:42 UTC] brunofr at ioda dot net
Description:
------------
Postgresql 9x set bytea_ouput = hex by default now.
This lead to a numerous trouble for a lot of application using pdo

Has been seen in major project like Drupal
http://drupal.org/node/926636

Reproduce code:
---------------
setup a default database and a table with a bytea column



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-28 17:01 UTC] goetas at lignano dot it
It depends if your client lib is up to date.

If you use Postgresql 9x PDO client libs have to be updated too.
 [2013-06-01 19:09 UTC] mbeccati@php.net
-Status: Open +Status: Not a bug -Package: PDO_PGSQL +Package: *General Issues
 [2013-06-01 19:09 UTC] mbeccati@php.net
PHP uses the functionality from libpq to decode bytea columns. If you have an old version that doesn't support hex bytea and you can't upgrade it, I'd suggest using something like:

ALTER DATABASE foo SET bytea_output TO 'escape';

or

ALTER ROLE bar SET bytea_output TO 'escape';
 [2013-06-01 19:10 UTC] mbeccati@php.net
-Package: *General Issues +Package: PDO related
 [2013-08-30 23:00 UTC] dregad at mantisbt dot org
Could someone kindly clarify exactly what version of the libpq library one needs to have, in order for PHP to recognize the 'hex' format ?

According to my phpinfo(), PostgreSQL(libpq) Version is 9.1.9, yet if I don't SET bytea_output TO escape, it does not work for me.

Cheers
 [2015-08-04 20:31 UTC] andrei at amateescu dot me
According to https://bugs.horde.org/ticket/10919#c4, libpq >= 9.2 works correctly and 9.1 is known to be broken.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 18:01:30 2024 UTC