Bug #73498 [NEW]: Incorrect SQL generated for pg_copy_to()
From: cward at titanhq dot com
Operating system: FreeBSD
PHP version: 5.6.28
Package: PostgreSQL related
Bug Type: Bug
Bug description:Incorrect SQL generated for pg_copy_to()
Description:
------------
pg_copy_to generates incorrect SQL for the Postgresql COPY TO
statement.
For instance:
pg_copy_to($connection, 'test');
generates:
COPY test TO STDOUT DELIMITERS E' ' WITH NULL AS E'\\N'
"DELIMITERS" is incorrect; it should be "DELIMITER". See Postgresql
manual:
https://www.postgresql.org/docs/current/static/sql-copy.html#AEN77298
However, this defect is only apparent if you try to use pg_copy_to on a
view, which is perfectly legal as documented here:
https://www.postgresql.org/docs/current/static/sql-copy.html#AEN77520
Test script:
---------------
pg_copy_to($connection, '(select * from test'));
Expected result:
----------------
Return the contents of the view into a formatted array
Actual result:
--------------
ERROR: syntax error at or near "DELIMITERS" at character 129
--
Edit bug report at https://bugs.php.net/bug.php?id=73498&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73498&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73498&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73498&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73498&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73498&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73498&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73498&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73498&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73498&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73498&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73498&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73498&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73498&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73498&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73498&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73498&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73498&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73498&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73498&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73498&r=mysqlcfg
Thread (4 messages)
- cward at titanhq dot com