summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-11-25 14:28:00 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-11-25 14:28:00 +0000
commita08f0425deee44ce4ab25c0a7c05b649f918bce3 (patch)
treef617f2bd275947e3269762c1d2e82470d9f16fec
parent8c3509c8944f5c6e69bbb0bf7f5f3c4aa68b3ccc (diff)
downloadphp-git-a08f0425deee44ce4ab25c0a7c05b649f918bce3.tar.gz
Fixed bug #50195 (pg_copy_to() fails when table name contains schema).
-rw-r--r--NEWS1
-rw-r--r--ext/pgsql/pgsql.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 653f37eee2..35d1579bb0 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ PHP NEWS
(Pierrick)
- Fixed bug #50207 (segmentation fault when concatenating very large strings
on 64bit linux). (Ilia)
+- Fixed bug #50195 (pg_copy_to() fails when table name contains schema. (Ilia)
- Fixed bug #50185 (ldap_get_entries() return false instead of an empty array
when there is no error). (Jani)
- Fixed bug #50174 (Incorrectly matched docComment). (Felipe)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index ffc7eb8ea3..c5f7535636 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -3341,7 +3341,11 @@ PHP_FUNCTION(pg_copy_to)
pg_null_as = safe_estrdup("\\\\N");
}
- spprintf(&query, 0, "COPY \"%s\" TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'", table_name, *pg_delim, pg_null_as);
+ if (memchr(table_name, '.', table_name_len)) {
+ spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'", table_name, *pg_delim, pg_null_as);
+ } else {
+ spprintf(&query, 0, "COPY \"%s\" TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'", table_name, *pg_delim, pg_null_as);
+ }
while ((pgsql_result = PQgetResult(pgsql))) {
PQclear(pgsql_result);