Re: patch: xmltable - proof concept

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: xmltable - proof concept
Date: 2016-08-09 17:30:48
Message-ID: 20160809173048.GA577162@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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!

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-08-09 17:44:31 Re: patch: xmltable - proof concept
Previous Message Pavel Stehule 2016-08-09 17:03:33 Re: patch: xmltable - proof concept