File tree 6 files changed +35
-19
lines changed
6 files changed +35
-19
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.245 2009/04/05 20:32:06 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.246 2009/04/08 21:51:38 petere Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -4671,27 +4671,16 @@ ExecInitExpr(Expr *node, PlanState *parent)
4671
4671
XmlExprState * xstate = makeNode (XmlExprState );
4672
4672
List * outlist ;
4673
4673
ListCell * arg ;
4674
- int i ;
4675
4674
4676
4675
xstate -> xprstate .evalfunc = (ExprStateEvalFunc ) ExecEvalXml ;
4677
- xstate -> named_outfuncs = (FmgrInfo * )
4678
- palloc0 (list_length (xexpr -> named_args ) * sizeof (FmgrInfo ));
4679
4676
outlist = NIL ;
4680
- i = 0 ;
4681
4677
foreach (arg , xexpr -> named_args )
4682
4678
{
4683
4679
Expr * e = (Expr * ) lfirst (arg );
4684
4680
ExprState * estate ;
4685
- Oid typOutFunc ;
4686
- bool typIsVarlena ;
4687
4681
4688
4682
estate = ExecInitExpr (e , parent );
4689
4683
outlist = lappend (outlist , estate );
4690
-
4691
- getTypeOutputInfo (exprType ((Node * ) e ),
4692
- & typOutFunc , & typIsVarlena );
4693
- fmgr_info (typOutFunc , & xstate -> named_outfuncs [i ]);
4694
- i ++ ;
4695
4684
}
4696
4685
xstate -> named_args = outlist ;
4697
4686
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.85 2009/03/27 18:56:57 tgl Exp $
10
+ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.86 2009/04/08 21:51:38 petere Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -572,7 +572,7 @@ xmlelement(XmlExprState *xmlExpr, ExprContext *econtext)
572
572
if (isnull )
573
573
str = NULL ;
574
574
else
575
- str = OutputFunctionCall ( & xmlExpr -> named_outfuncs [ i ], value );
575
+ str = map_sql_value_to_xml_value ( value , exprType (( Node * ) e -> expr ) );
576
576
named_arg_strings = lappend (named_arg_strings , str );
577
577
i ++ ;
578
578
}
@@ -609,12 +609,9 @@ xmlelement(XmlExprState *xmlExpr, ExprContext *econtext)
609
609
char * argname = strVal (lfirst (narg ));
610
610
611
611
if (str )
612
- {
613
612
xmlTextWriterWriteAttribute (writer ,
614
613
(xmlChar * ) argname ,
615
614
(xmlChar * ) str );
616
- pfree (str );
617
- }
618
615
}
619
616
620
617
foreach (arg , arg_strings )
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.203 2009/04/02 22:39:30 tgl Exp $
10
+ * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.204 2009/04/08 21:51:38 petere Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -847,7 +847,6 @@ typedef struct XmlExprState
847
847
{
848
848
ExprState xprstate ;
849
849
List * named_args ; /* ExprStates for named arguments */
850
- FmgrInfo * named_outfuncs ; /* array of output fns for named arguments */
851
850
List * args ; /* ExprStates for other arguments */
852
851
} XmlExprState ;
853
852
Original file line number Diff line number Diff line change @@ -173,6 +173,21 @@ SELECT xmlelement(name foo, bytea 'bar');
173
173
<foo>626172</foo>
174
174
(1 row)
175
175
176
+ SELECT xmlelement(name foo, xmlattributes(true as bar));
177
+ xmlelement
178
+ -------------------
179
+ <foo bar="true"/>
180
+ (1 row)
181
+
182
+ SELECT xmlelement(name foo, xmlattributes('2009-04-09 00:24:37'::timestamp as bar));
183
+ xmlelement
184
+ ----------------------------------
185
+ <foo bar="2009-04-09T00:24:37"/>
186
+ (1 row)
187
+
188
+ SELECT xmlelement(name foo, xmlattributes('infinity'::timestamp as bar));
189
+ ERROR: timestamp out of range
190
+ DETAIL: XML does not support infinite timestamp values.
176
191
SELECT xmlparse(content 'abc');
177
192
xmlparse
178
193
----------
Original file line number Diff line number Diff line change @@ -148,6 +148,18 @@ SELECT xmlelement(name foo, bytea 'bar');
148
148
ERROR: unsupported XML feature
149
149
DETAIL: This functionality requires the server to be built with libxml support.
150
150
HINT: You need to rebuild PostgreSQL using --with-libxml.
151
+ SELECT xmlelement(name foo, xmlattributes(true as bar));
152
+ ERROR: unsupported XML feature
153
+ DETAIL: This functionality requires the server to be built with libxml support.
154
+ HINT: You need to rebuild PostgreSQL using --with-libxml.
155
+ SELECT xmlelement(name foo, xmlattributes('2009-04-09 00:24:37'::timestamp as bar));
156
+ ERROR: unsupported XML feature
157
+ DETAIL: This functionality requires the server to be built with libxml support.
158
+ HINT: You need to rebuild PostgreSQL using --with-libxml.
159
+ SELECT xmlelement(name foo, xmlattributes('infinity'::timestamp as bar));
160
+ ERROR: unsupported XML feature
161
+ DETAIL: This functionality requires the server to be built with libxml support.
162
+ HINT: You need to rebuild PostgreSQL using --with-libxml.
151
163
SELECT xmlparse(content 'abc');
152
164
ERROR: unsupported XML feature
153
165
DETAIL: This functionality requires the server to be built with libxml support.
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ SELECT xmlelement(name foo, bytea 'bar');
54
54
SET xmlbinary TO hex;
55
55
SELECT xmlelement(name foo, bytea ' bar' );
56
56
57
+ SELECT xmlelement(name foo, xmlattributes(true as bar));
58
+ SELECT xmlelement(name foo, xmlattributes(' 2009-04-09 00:24:37' ::timestamp as bar));
59
+ SELECT xmlelement(name foo, xmlattributes(' infinity' ::timestamp as bar));
60
+
57
61
58
62
SELECT xmlparse(content ' abc' );
59
63
SELECT xmlparse(content ' <abc>x</abc>' );
You can’t perform that action at this time.
0 commit comments