From: Felipe Pena Date: Tue, 20 Apr 2010 15:59:01 +0000 (+0000) Subject: - Fixed bug #51607 (pg_copy_from does not allow schema in the tablename argument) X-Git-Tag: php-5.2.14RC1~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4934e2f0727cb5a211af2e2b39e9ceb721f32ff6;p=php - Fixed bug #51607 (pg_copy_from does not allow schema in the tablename argument) Patch by: cbandy at jbandy dot com --- diff --git a/NEWS b/NEWS index a19e122843..1c65adef21 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ PHP NEWS (Felipe) - Fixed bug #51608 (pg_copy_to: WARNING: nonstandard use of \\ in a string literal). (cbandy at jbandy dot com) +- Fixed bug #51607 (pg_copy_from does not allow schema in the tablename + argument). (cbandy at jbandy dot com) - Fixed bug #51445 (var_dump() invalid/slow *RECURSION* detection). (Felipe) - Fixed bug #51393 (DateTime::createFromFormat() fails if format string contains timezone). (Adam) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 807ed3074b..39fbfa6b87 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -3342,11 +3342,7 @@ PHP_FUNCTION(pg_copy_to) free_pg_null = 1; } - if (memchr(table_name, '.', table_name_len)) { - spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); - } else { - spprintf(&query, 0, "COPY \"%s\" TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); - } + spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); @@ -3478,7 +3474,7 @@ PHP_FUNCTION(pg_copy_from) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); - spprintf(&query, 0, "COPY \"%s\" FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); + spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); }