Re: patch: function xmltable

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Craig Ringer <craig@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2016-11-23T16:54:48Z
Lists: pgsql-hackers
I tried to see if a following RTE was able to "see" the entries created by
XMLTABLE, and sure it can:

SELECT X.*, generate_series 
FROM emp, 
XMLTABLE ('//depts/dept/employee' passing doc 
   COLUMNS 
   empID    INTEGER     PATH '@id',
   firstname    varchar(25)     PATH 'name/first',
   lastname     VARCHAR(25)     PATH 'name/last') AS X,
generate_series(900, empid);

 empid │ firstname │ lastname │ generate_series 
───────┼───────────┼──────────┼─────────────────
   901 │ John      │ Doe      │             900
   901 │ John      │ Doe      │             901
   902 │ Peter     │ Pan      │             900
   902 │ Peter     │ Pan      │             901
   902 │ Peter     │ Pan      │             902
   903 │ Mary      │ Jones    │             900
   903 │ Mary      │ Jones    │             901
   903 │ Mary      │ Jones    │             902
   903 │ Mary      │ Jones    │             903
(9 filas)

Cool.

I'm still wondering how this works.  I'll continue to explore the patch
in order to figure out.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Commits

  1. Support XMLTABLE query expression

  2. Create <sect3> in the functions-xml section

  3. Improve handling of "UPDATE ... SET (column_list) = row_constructor".

  4. Add xmlexists function