agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: Shaozhong SHI <shishaozhong@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Mike Martin <redtux1@gmail.com>
Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>
Subject: Re: Question about WITH ORDINALITY and unnest
Date: Sat, 23 Jan 2021 16:50:10 -0500
Message-ID: <1382518.1611438610@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+i5JwZiY5bdAwTvUoREGkcvA1J=eec4MmbwMncDjS8r0AV0Mw@mail.gmail.com>
References: <CAOwYNKahL2DCvqx7E_aiWkFE50aHuK3wBwPyb-2_u+P9ObRu_A@mail.gmail.com>
<CAKFQuwZpWf8SKrqLB3e4CFuLNinRM2-Ouy-xT84CTyO55CkeHA@mail.gmail.com>
<CA+i5JwZiY5bdAwTvUoREGkcvA1J=eec4MmbwMncDjS8r0AV0Mw@mail.gmail.com>
Shaozhong SHI <shishaozhong@gmail.com> writes:
> Has anyone got a nice way to deal with unequal numbers of elements in
> arrays?
This might or might not be what you want, but:
db=# select * from unnest(ARRAY[1,2], ARRAY['foo','bar','baz']) as x(a,b);
a | b
---+-----
1 | foo
2 | bar
| baz
(3 rows)
regards, tom lane
view thread (4+ messages)
Message-ID: <1382518.1611438610@sss.pgh.pa.us>
Permalink: ../1382518.1611438610@sss.pgh.pa.us/
Also on: postgresql.org/message-id/1382518.1611438610@sss.pgh.pa.us
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, shishaozhong@gmail.com, david.g.johnston@gmail.com, redtux1@gmail.com, pgsql-sql@lists.postgresql.org
Subject: Re: Question about WITH ORDINALITY and unnest
In-Reply-To: <1382518.1611438610@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox