From: Karl Koster <klkoster@optonline.net>
To: pgsql-sql@postgresql.org
Subject: unnest in SELECT
Date: Fri, 20 May 2011 15:45:17 -0400
Message-ID: <4DD6C4CD.40406@optonline.net> (raw)
I have a couple of questions regarding unnest.
1) If I issue a select statement "select unnest(vector1) as v from
some_table", I cannot seem to use the column alias v in a WHERE or
HAVING clause. I can use it in an ORDER BY or GROUP by clause. Is this
the way it is supposed to work?
2) If I issue a select statement "select unnest(vector1) as v1,
unnest(vector2) as v2 from some_table" and vector1 has a length of 3 and
vector2 has a length of 4, the result set will have 12 rows with the
data of vector1 repeating 4 times and vector2 repeating 3 times.
Shouldn't the content of the shorter array(s) simply be return null in
it's respective column and the result set be the size of the longest array?
Thanks,
Karl
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: klkoster@optonline.net
Subject: Re: unnest in SELECT
In-Reply-To: <4DD6C4CD.40406@optonline.net>
* 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