php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47639 pg_copy_from: WARNING: nonstandard use of \\ in a string literal
Submitted: 2009-03-12 18:46 UTC Modified: 2009-03-12 22:54 UTC
From: thuejk at gmail dot com Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 5.2.9 OS: Linux
Private report: No CVE-ID:
 [2009-03-12 18:46 UTC] 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));



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-12 22:54 UTC] iliaa@php.net
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.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 04:01:55 2014 UTC