pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: duncanmgillis@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13745: Alias notation after WITH ORDINALITY flattens composite types
Date: Thu, 29 Oct 2015 13:07:25 +0000
Message-ID: <20151029130725.3019.14923@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13745
Logged by:          Duncan Gillis
Email address:      duncanmgillis@gmail.com
PostgreSQL version: 9.4.4
Operating system:   Ubuntu 13.04; Ubuntu 14.04
Description:        

With "arr" being an array of some composite type, "UNNEST(arr) WITH
ORDINALITY _(rec, idx)" suprisingly will populate "rec" and "idx" with the
first two elements from each record in array, rather than the entire record
followed by the ordinality of that record.

This seems inconsistent with how the aliasing behaviour works with
subqueries. It also gets very tedious if you need to unpack a composite type
with lots of fields only to have to put it together again in the SELECT
clause:

SELECT ROW(col1, col2, ..., colN)::some_table, row_idx
FROM UNNEST(array_of_rows) WITH ORDINALITY _(col1, col2, ..., colN,
row_idx)





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



Message-ID: <20151029130725.3019.14923@wrigleys.postgresql.org>
Permalink:  ../20151029130725.3019.14923@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20151029130725.3019.14923@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: duncanmgillis@gmail.com
  Subject: Re: BUG #13745: Alias notation after WITH ORDINALITY flattens composite types
  In-Reply-To: <20151029130725.3019.14923@wrigleys.postgresql.org>
  References: <20151029130725.3019.14923@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox