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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to