Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8b35795

Browse files
committed
Use XML output escaping also in XMLFOREST.
1 parent 92dffbd commit 8b35795

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/backend/executor/execQual.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.205 2007/01/10 20:33:54 petere Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.206 2007/01/12 21:47:26 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2692,11 +2692,10 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
26922692
value = ExecEvalExpr(e, econtext, &isnull, NULL);
26932693
if (!isnull)
26942694
{
2695-
str = OutputFunctionCall(&xmlExpr->named_outfuncs[i],
2696-
value);
26972695
appendStringInfo(&buf, "<%s>%s</%s>",
2698-
argname, str, argname);
2699-
pfree(str);
2696+
argname,
2697+
map_sql_value_to_xml_value(value, exprType((Node *) e->expr)),
2698+
argname);
27002699
*isNull = false;
27012700
}
27022701
i++;

src/backend/utils/adt/xml.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.15 2007/01/12 16:29:24 petere Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.16 2007/01/12 21:47:26 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -70,8 +70,6 @@ static void xml_ereport_by_code(int level, int sqlcode,
7070
static xmlChar *xml_text2xmlChar(text *in);
7171
static xmlDocPtr xml_parse(text *data, bool is_document, bool preserve_whitespace);
7272

73-
static char *map_sql_value_to_xml_value(Datum value, Oid type);
74-
7573
#endif /* USE_LIBXML */
7674

7775
#define NO_XML_SUPPORT() \
@@ -1260,11 +1258,10 @@ map_xml_name_to_sql_identifier(char *name)
12601258
}
12611259

12621260

1263-
#ifdef USE_LIBXML
12641261
/*
12651262
* Map SQL value to XML value; see SQL/XML:2003 section 9.16.
12661263
*/
1267-
static char *
1264+
char *
12681265
map_sql_value_to_xml_value(Datum value, Oid type)
12691266
{
12701267
StringInfoData buf;
@@ -1341,4 +1338,3 @@ map_sql_value_to_xml_value(Datum value, Oid type)
13411338

13421339
return buf.data;
13431340
}
1344-
#endif /* USE_LIBXML */

src/include/utils/xml.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.8 2007/01/10 20:33:54 petere Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.9 2007/01/12 21:47:27 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -40,5 +40,6 @@ extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
4040

4141
extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped);
4242
extern char *map_xml_name_to_sql_identifier(char *name);
43+
extern char *map_sql_value_to_xml_value(Datum value, Oid type);
4344

4445
#endif /* XML_H */

0 commit comments

Comments
 (0)