Incorrect SQL generated for pg_copy_to()
| Bug #73498 | Incorrect SQL generated for pg_copy_to() | ||||
|---|---|---|---|---|---|
| Submitted: | 2016-11-11 13:44 UTC | Modified: | 2016-11-21 11:45 UTC | ||
| From: | cward at titanhq dot com | Assigned: | |||
| Status: | Closed | Package: | PostgreSQL related | ||
| PHP Version: | 5.6.28 | OS: | FreeBSD | ||
| Private report: | No | CVE-ID: | None | ||
[2016-11-11 13:44 UTC] cward at titanhq dot com
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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2016-11-20 20:54 UTC] php at duncanc dot co dot uk
[2016-11-21 11:45 UTC] cward at titanhq dot com
[2016-11-21 23:48 UTC] ab@php.net
-Status: Open +Status: Closed