Aliasing syntax question

From: Kevin Murphy <murphy(at)genome(dot)chop(dot)edu>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Aliasing syntax question
Date: 2009-02-19 17:24:49
Message-ID: 499D95E1.2080904@genome.chop.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've now seen the 'unnest' function defined in a few different ways with
regard to aliases.

Substitute the following pairs of values for X and Y in the query below,
and all of them work (in PG 8.3.6, at least):

X Y
g g
i g(i)
g g(i)
g.i g(i)

create or replace function unnest(anyarray)
returns setof anyelement as $$
select $1[X] from generate_series(array_lower($1,1),array_upper($1,1)) Y;
$$ language sql;

Please enlighten the unworthy!

Thanks,
Kevin Murphy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-02-19 17:31:16 Re: How to pipe the psql copy command to Unix 'Date' command
Previous Message Mirko Pace 2009-02-19 17:07:49 Re: How to pipe the psql copy command to Unix 'Date' command