File tree Expand file tree Collapse file tree 6 files changed +35
-19
lines changed
Expand file tree Collapse file tree 6 files changed +35
-19
lines changed Original file line number Diff line number Diff line change 88 *
99 *
1010 * 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 $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -4671,27 +4671,16 @@ ExecInitExpr(Expr *node, PlanState *parent)
46714671 XmlExprState * xstate = makeNode (XmlExprState );
46724672 List * outlist ;
46734673 ListCell * arg ;
4674- int i ;
46754674
46764675 xstate -> xprstate .evalfunc = (ExprStateEvalFunc ) ExecEvalXml ;
4677- xstate -> named_outfuncs = (FmgrInfo * )
4678- palloc0 (list_length (xexpr -> named_args ) * sizeof (FmgrInfo ));
46794676 outlist = NIL ;
4680- i = 0 ;
46814677 foreach (arg , xexpr -> named_args )
46824678 {
46834679 Expr * e = (Expr * ) lfirst (arg );
46844680 ExprState * estate ;
4685- Oid typOutFunc ;
4686- bool typIsVarlena ;
46874681
46884682 estate = ExecInitExpr (e , parent );
46894683 outlist = lappend (outlist , estate );
4690-
4691- getTypeOutputInfo (exprType ((Node * ) e ),
4692- & typOutFunc , & typIsVarlena );
4693- fmgr_info (typOutFunc , & xstate -> named_outfuncs [i ]);
4694- i ++ ;
46954684 }
46964685 xstate -> named_args = outlist ;
46974686
Original file line number Diff line number Diff line change 77 * Portions Copyright (c) 1996-2009, 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.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 $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -572,7 +572,7 @@ xmlelement(XmlExprState *xmlExpr, ExprContext *econtext)
572572 if (isnull )
573573 str = NULL ;
574574 else
575- str = OutputFunctionCall ( & xmlExpr -> named_outfuncs [ i ], value );
575+ str = map_sql_value_to_xml_value ( value , exprType (( Node * ) e -> expr ) );
576576 named_arg_strings = lappend (named_arg_strings , str );
577577 i ++ ;
578578 }
@@ -609,12 +609,9 @@ xmlelement(XmlExprState *xmlExpr, ExprContext *econtext)
609609 char * argname = strVal (lfirst (narg ));
610610
611611 if (str )
612- {
613612 xmlTextWriterWriteAttribute (writer ,
614613 (xmlChar * ) argname ,
615614 (xmlChar * ) str );
616- pfree (str );
617- }
618615 }
619616
620617 foreach (arg , arg_strings )
Original file line number Diff line number Diff line change 77 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
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 $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -847,7 +847,6 @@ typedef struct XmlExprState
847847{
848848 ExprState xprstate ;
849849 List * named_args ; /* ExprStates for named arguments */
850- FmgrInfo * named_outfuncs ; /* array of output fns for named arguments */
851850 List * args ; /* ExprStates for other arguments */
852851} XmlExprState ;
853852
Original file line number Diff line number Diff line change @@ -173,6 +173,21 @@ SELECT xmlelement(name foo, bytea 'bar');
173173 <foo>626172</foo>
174174(1 row)
175175
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.
176191SELECT xmlparse(content 'abc');
177192 xmlparse
178193----------
Original file line number Diff line number Diff line change @@ -148,6 +148,18 @@ SELECT xmlelement(name foo, bytea 'bar');
148148ERROR: unsupported XML feature
149149DETAIL: This functionality requires the server to be built with libxml support.
150150HINT: 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.
151163SELECT xmlparse(content 'abc');
152164ERROR: unsupported XML feature
153165DETAIL: 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');
5454SET xmlbinary TO hex;
5555SELECT xmlelement(name foo, bytea ' bar' );
5656
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+
5761
5862SELECT xmlparse(content ' abc' );
5963SELECT xmlparse(content ' <abc>x</abc>' );
You can’t perform that action at this time.
0 commit comments