#47639 [Opn->Csd]: pg_copy_from: WARNING: nonstandard use of \\ in a string literal
| From: | iliaa@php.net | Date: | Thu, 12 Mar 2009 22:54:28 +0000 |
| Subject: | #47639 [Opn->Csd]: pg_copy_from: WARNING: nonstandard use of \\ in a string literal | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134652@lists.php.net to get a copy of this message | ||
ID: 47639
Updated by: iliaa@php.net
Reported By: thuejk at gmail dot com
-Status: Open
+Status: Closed
Bug Type: PostgreSQL related
Operating System: Linux
PHP Version: 5.2.9
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-03-12 18:46:23] thuejk at gmail dot com
Description:
------------
Whenever I use pg_copy_from() I get an error in
/var/log/postgresql/postgresql-8.3-main.log :
2009-03-12 19:43:12 CET WARNING: nonstandard use of \\ in a string
literal at character 82
2009-03-12 19:43:12 CET HINT: Use the escape string syntax for
backslashes, e.g., E'\\'.
This is caused by pg_copy_from(), which in pgsql.c does something like
the following:
spprintf(&query, 0, "COPY \"%s\" FROM STDIN DELIMITERS '%c' WITH
NULL AS '%s'", table_name, *pg_delim, "\\\\N");
If I pass the optional custom NULL indicator arg to pg_copy_from, ie
replace "\\\\N" with for example "NULL", then the error goes away.
Reproduce code:
---------------
pg_query($db->connection, "CREATE TABLE test(a INT)");
pg_copy_from($db->connection, "test", Array(1));
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47639&edit=1