diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2009-11-25 14:28:00 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2009-11-25 14:28:00 +0000 |
commit | 23f4da91137967d5769f3100ecc2e712641cf37d (patch) | |
tree | 15b1da700cb90a78a7d03d221ce552a42270aea3 | |
parent | bf7ed5eff5a39724b59beffaa3af2fc08117f490 (diff) | |
download | php-git-23f4da91137967d5769f3100ecc2e712641cf37d.tar.gz |
Fixed bug #50195 (pg_copy_to() fails when table name contains schema).
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 6 |
2 files changed, 6 insertions, 1 deletions
@@ -42,6 +42,7 @@ PHP NEWS (Ilia, shigeru_kitazaki at cybozu dot co dot jp) - 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 #50140 (With default compilation option, php symbols are diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 57fac7e26e..4b79b37c91 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -3764,7 +3764,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); |