Commit 2315df21 authored by Tom Lane's avatar Tom Lane

Fix a couple of places that were assuming debug_query_string couldn't

be NULL ... seems an unsafe assumption.
parent 68189220
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Darko Prenosil <Darko.Prenosil@finteh.hr> * Darko Prenosil <Darko.Prenosil@finteh.hr>
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in> * Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
* *
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.59 2006/10/04 00:29:44 momjian Exp $ * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.60 2006/10/19 19:53:03 tgl Exp $
* Copyright (c) 2001-2006, PostgreSQL Global Development Group * Copyright (c) 2001-2006, PostgreSQL Global Development Group
* ALL RIGHTS RESERVED; * ALL RIGHTS RESERVED;
* *
...@@ -1640,7 +1640,10 @@ PG_FUNCTION_INFO_V1(dblink_current_query); ...@@ -1640,7 +1640,10 @@ PG_FUNCTION_INFO_V1(dblink_current_query);
Datum Datum
dblink_current_query(PG_FUNCTION_ARGS) 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();
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.56 2006/10/04 00:29:51 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.57 2006/10/19 19:53:03 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -113,7 +113,7 @@ PerformCursorOpen(DeclareCursorStmt *stmt, ParamListInfo params) ...@@ -113,7 +113,7 @@ PerformCursorOpen(DeclareCursorStmt *stmt, ParamListInfo params)
*/ */
PortalDefineQuery(portal, PortalDefineQuery(portal,
NULL, NULL,
pstrdup(debug_query_string), debug_query_string ? pstrdup(debug_query_string) : NULL,
"SELECT", /* cursor's query is always a SELECT */ "SELECT", /* cursor's query is always a SELECT */
list_make1(query), list_make1(query),
list_make1(plan), list_make1(plan),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment