From: Ilia Alshanetsky Date: Wed, 25 Nov 2009 14:28:00 +0000 (+0000) Subject: Fixed bug #50195 (pg_copy_to() fails when table name contains schema). X-Git-Tag: php-5.4.0alpha1~191^2~2341 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3017ed210a05de11d89977b811874b04162cd852;p=php Fixed bug #50195 (pg_copy_to() fails when table name contains schema). --- diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 6e76dfa9bf..7b41526318 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -3763,7 +3763,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);