Skip site navigation (1) Skip section navigation (2)

Re: patch: function xmltable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Subject: Re: patch: function xmltable
Date: 2017-03-05 09:32:18
Message-ID: CAFj8pRAjrX_dtdUdfH2DjEdsh3NZkXV3PLJTjUnyXKji9ChteQ@mail.gmail.com (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-hackers
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

Attachment: xmltable-50.patch.gz
Description: application/x-gzip (36.5 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2017-03-05 10:02:08
Subject: Re: dropping partitioned tables without CASCADE
Previous:From: Ashutosh BapatDate: 2017-03-05 07:59:33
Subject: Re: dropping partitioned tables without CASCADE

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group