Re: patch: xmltable - proof concept

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>
Subject: Re: patch: xmltable - proof concept
Date: 2016-08-09 17:44:31
Message-ID: CAFj8pRCYt7RcHUQYtyuskJqTdiptci+4mTwCrH3eASbOK23emw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-08-09 19:30 GMT+02:00 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:

> Pavel Stehule wrote:
>
> > postgres=# SELECT xmltable.*
> > postgres-# FROM (SELECT data FROM xmldata) x,
> > postgres-# LATERAL xmltable('/ROWS/ROW'
> > postgres(# PASSING data
> > postgres(# COLUMNS id int PATH '@id',
> > postgres(# country_name text PATH
> > 'COUNTRY_NAME',
> > postgres(# country_id text PATH
> > 'COUNTRY_ID',
> > postgres(# region_id int PATH
> 'REGION_ID',
> > postgres(# size float PATH 'SIZE',
> > postgres(# unit text PATH 'SIZE/@unit',
> > postgres(# premier_name text PATH
> > 'PREMIER_NAME' DEFAULT 'not specified');
> > ┌────┬──────────────┬────────────┬───────────┬──────┬──────┬
> ───────────────┐
> > │ id │ country_name │ country_id │ region_id │ size │ unit │
> premier_name │
> > ╞════╪══════════════╪════════════╪═══════════╪══════╪══════╪
> ═══════════════╡
> > │ 1 │ Australia │ AU │ 3 │ ¤ │ ¤ │ not
> specified │
> > │ 2 │ China │ CN │ 3 │ ¤ │ ¤ │ not
> specified │
> > │ 3 │ HongKong │ HK │ 3 │ ¤ │ ¤ │ not
> specified │
> > │ 4 │ India │ IN │ 3 │ ¤ │ ¤ │ not
> specified │
> > │ 5 │ Japan │ JP │ 3 │ ¤ │ ¤ │ Sinzo Abe
> │
> > │ 6 │ Singapore │ SG │ 3 │ 791 │ km │ not
> specified │
> > └────┴──────────────┴────────────┴───────────┴──────┴──────┴
> ───────────────┘
> > (6 rows)
>
> Nice work!
>

Thank you

Pavel

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2016-08-09 17:44:37 9.6 phrase search distance specification
Previous Message Alvaro Herrera 2016-08-09 17:30:48 Re: patch: xmltable - proof concept