php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63657 pgsqlCopyFromFile, pgsqlCopyToArray use Postgres < 7.3 syntax
Submitted: 2012-11-30 12:28 UTC Modified: 2013-06-07 07:19 UTC
From: ch@php.net Assigned: mbeccati
Status: Closed Package: PDO related
PHP Version: 5.4.9 OS:
Private report: No CVE-ID:
 [2012-11-30 12:28 UTC] ch@php.net
Description:
------------
In ext/pdo_pgsql/pgsql_driver.c the methods pgsqlCopyToArray, pgsqlCopyFromArray etc. all use the following syntax:

  COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'

In at least PostgreSQL 9.2 this is a syntax error though. The correct syntax is:

  COPY %s FROM STDIN WITH DELIMITER E'%c', NULL AS E'%s'

a) the "WITH" is optional but must come immediately after the STDIN if given
b) it's a singular "DELIMITER", not plural


(btw, these method are undocumented anyway, see my other bug report about that)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-04 23:57 UTC] mbeccati@php.net
-Assigned To: +Assigned To: mbeccati
 [2013-06-07 07:19 UTC] mbeccati@php.net
-Summary: pgsqlCopyFromFile, pgsqlCopyToArray have syntax errors +Summary: pgsqlCopyFromFile, pgsqlCopyToArray use Postgres < 7.3 syntax
 [2013-06-07 07:19 UTC] mbeccati@php.net
That's simply not true. If you were receiving an error, it must have been something else. See:

http://www.postgresql.org/docs/9.2/static/sql-copy.html#AEN66829

At some point compatibility with <7.3 syntax might be dropped though, so I'm going to follow the suggestion anyway (using pre-9.0 syntax).
 [2013-06-07 07:41 UTC] mbeccati@php.net
Automatic comment on behalf of mbeccati
Revision: http://git.php.net/?p=php-src.git;a=commit;h=19ead23e8ec1e09bce080139a92d372ff1a8416b
Log: Fixed bug #63657 (pgsqlCopyFrom/To methods use Postgres &lt; 7.3 syntax)
 [2013-06-07 07:41 UTC] mbeccati@php.net
-Status: Assigned +Status: Closed
 [2013-11-17 09:30 UTC] laruence@php.net
Automatic comment on behalf of mbeccati
Revision: http://git.php.net/?p=php-src.git;a=commit;h=19ead23e8ec1e09bce080139a92d372ff1a8416b
Log: Fixed bug #63657 (pgsqlCopyFrom/To methods use Postgres &lt; 7.3 syntax)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Fri Jul 28 00:01:36 2017 UTC