Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3QnW-0002WO-H9 for pgsql-sql@arkaria.postgresql.org; Sat, 23 Jan 2021 21:50:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l3QnU-0003dh-68 for pgsql-sql@arkaria.postgresql.org; Sat, 23 Jan 2021 21:50:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3QnT-0003dY-W2 for pgsql-sql@lists.postgresql.org; Sat, 23 Jan 2021 21:50:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3QnN-0006s1-CS for pgsql-sql@lists.postgresql.org; Sat, 23 Jan 2021 21:50:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 10NLoAY71382519; Sat, 23 Jan 2021 16:50:10 -0500 From: Tom Lane To: Shaozhong SHI cc: "David G. Johnston" , Mike Martin , pgsql-sql Subject: Re: Question about WITH ORDINALITY and unnest In-reply-to: References: Comments: In-reply-to Shaozhong SHI message dated "Sat, 23 Jan 2021 21:14:11 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1382517.1611438610.1@sss.pgh.pa.us> Date: Sat, 23 Jan 2021 16:50:10 -0500 Message-ID: <1382518.1611438610@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Shaozhong SHI 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