Re: patch: function xmltable
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Craig Ringer <craig@2ndquadrant.com>
Date: 2017-03-05T09:32:18Z
Lists: pgsql-hackers
Attachments
- xmltable-50.patch.gz (application/x-gzip) patch
Hi
I used your idea about special columns when COLUMNS are not explicitly
defined.
All lines that you are dislike removed.
Now, almost all code, related to this behave, is in next few lines.
+ /*
+ * Use implicit column when it is necessary. The COLUMNS clause is
optional
+ * on Oracle and DB2. In this case a result is complete row of XML type.
+ */
+ if (rtf->columns == NIL)
+ {
+ RangeTableFuncCol *fc = makeNode(RangeTableFuncCol);
+ A_Const *n = makeNode(A_Const);
+
+ fc->colname = "xmltable";
+ fc->typeName = makeTypeNameFromOid(XMLOID, -1);
+ n->val.type = T_String;
+ n->val.val.str = ".";
+ n->location = -1;
+
+ fc->colexpr = (Node *) n;
+ rtf->columns = list_make1(fc);
+ }
all regress tests passing.
Regards
Pavel
Commits
-
Support XMLTABLE query expression
- fcec6caafa23 10.0 landed
-
Create <sect3> in the functions-xml section
- 4461a9bfd1ac 10.0 landed
-
Improve handling of "UPDATE ... SET (column_list) = row_constructor".
- 906bfcad7ba7 10.0 cited
-
Add xmlexists function
- 641459f26954 9.1.0 cited