From: Tom Lane Date: Thu, 19 Oct 2006 19:53:03 +0000 (+0000) Subject: Fix a couple of places that were assuming debug_query_string couldn't X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=eec83b4a8d1f82fd4eda68b68cc94c25bcb61abd;p=users%2Fbernd%2Fpostgres.git Fix a couple of places that were assuming debug_query_string couldn't be NULL ... seems an unsafe assumption. --- diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index 1a22c089a1..a0ab81c18a 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -1640,7 +1640,10 @@ PG_FUNCTION_INFO_V1(dblink_current_query); Datum dblink_current_query(PG_FUNCTION_ARGS) { - PG_RETURN_TEXT_P(GET_TEXT(debug_query_string)); + if (debug_query_string) + PG_RETURN_TEXT_P(GET_TEXT(debug_query_string)); + else + PG_RETURN_NULL(); } diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c index 0ec0775ead..9989e513f0 100644 --- a/src/backend/commands/portalcmds.c +++ b/src/backend/commands/portalcmds.c @@ -113,7 +113,7 @@ PerformCursorOpen(DeclareCursorStmt *stmt, ParamListInfo params) */ PortalDefineQuery(portal, NULL, - pstrdup(debug_query_string), + debug_query_string ? pstrdup(debug_query_string) : NULL, "SELECT", /* cursor's query is always a SELECT */ list_make1(query), list_make1(plan),