Skip to content

Commit 2315df2

Browse files
committed
Fix a couple of places that were assuming debug_query_string couldn't
be NULL ... seems an unsafe assumption.
1 parent 6818922 commit 2315df2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

contrib/dblink/dblink.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Darko Prenosil <Darko.Prenosil@finteh.hr>
99
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
1010
*
11-
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.59 2006/10/04 00:29:44 momjian Exp $
11+
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.60 2006/10/19 19:53:03 tgl Exp $
1212
* Copyright (c) 2001-2006, PostgreSQL Global Development Group
1313
* ALL RIGHTS RESERVED;
1414
*
@@ -1640,7 +1640,10 @@ PG_FUNCTION_INFO_V1(dblink_current_query);
16401640
Datum
16411641
dblink_current_query(PG_FUNCTION_ARGS)
16421642
{
1643-
PG_RETURN_TEXT_P(GET_TEXT(debug_query_string));
1643+
if (debug_query_string)
1644+
PG_RETURN_TEXT_P(GET_TEXT(debug_query_string));
1645+
else
1646+
PG_RETURN_NULL();
16441647
}
16451648

16461649

src/backend/commands/portalcmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.56 2006/10/04 00:29:51 momjian Exp $
17+
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.57 2006/10/19 19:53:03 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -113,7 +113,7 @@ PerformCursorOpen(DeclareCursorStmt *stmt, ParamListInfo params)
113113
*/
114114
PortalDefineQuery(portal,
115115
NULL,
116-
pstrdup(debug_query_string),
116+
debug_query_string ? pstrdup(debug_query_string) : NULL,
117117
"SELECT", /* cursor's query is always a SELECT */
118118
list_make1(query),
119119
list_make1(plan),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy