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 1jLcma-0004kq-9d for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 01:12:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLcmZ-0004Ym-1c for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 01:12:03 +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 1jLcmY-0004Yf-M5 for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 01:12:02 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jLcmV-0007cC-A6 for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 01:12:02 +0000 Received: by mail-pj1-x1034.google.com with SMTP id k3so31756pjj.2 for ; Mon, 06 Apr 2020 18:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:to; bh=gsP2W4qqLLAVbNupaNEotluV/K/w0Yhvi0SOe/0eIpU=; b=qzayTv/KEISb0QRMT/hQcAKSqCnLBRk3t35YVCItN6MHpT5HKaL8LrklXrxCvjVPk2 ztr/jNjd+ypx7oI4/GwgIS5nRsIcYh9DuCy14LxU8QjEhuygaFk6Nm29KqaFlci5QHVW 0U9bmw/tDslTxQdzO0/Z3gmT0lCnYEG8di3ujAaO6oFnn4zOnPu+yLLF4lX7b0qt0piM c6yGAwANnqxqmdUxHm0fI7H7BkQXx61DsQKIgKp6xCMWHBuzgJf4XSydKAVIGSD0SGD9 tR7LAYUwcNXkfy+A50hk/jSsAjBANwUA7Q9RNUXG9doWumhOLT/mF044ACyVXdi4nAa5 wepA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=gsP2W4qqLLAVbNupaNEotluV/K/w0Yhvi0SOe/0eIpU=; b=Njk66hws9QshT901+UQ4h4jvbXcIjrUkgxBazWXNpgd8DNPORgmT/XQrn0nb/T+9ve rq3qkMDFG7609e4+lFmni50a2VoxIh4G3ekXGtQsFgbCeKlOBEREpd6qEG5tfch/fPIL 4e5wrE1yXC0a3kgcC2dwYRIwOdmgPpkCsa7v6n39Gcm3bvXpKJdpho/QzCzRzPFe09hT qMENKKQyAL05FRYiqyn8elsTtexmW+DDrH0ykKFxw7FgvT3wXx1Pe2MnOXzkv1yf2nZH ffEaSSh2SG4CH1MwF7TRvje36bpCRzrN4XGLMAD6iNYkG6ekapFx8qeUPyq5+SvrgILC HOiQ== X-Gm-Message-State: AGi0PuZ54QpjMZX4zdyUTOEvzhKUNiVBBlE5z/l5tf1dM3YDMIMawczE h+Ws1heBUnSEkHcVnC++kxSDBxEZTtg= X-Google-Smtp-Source: APiQypIf4D+qMnqi+OzOPZp/57TRZK0+3E6dqoDehULWfqI7ecKtiOMuuQDyG24HbV/SBSLYFWxIwA== X-Received: by 2002:a17:90a:8c06:: with SMTP id a6mr2390463pjo.52.1586221916324; Mon, 06 Apr 2020 18:11:56 -0700 (PDT) Received: from ?IPv6:2600:8801:8800:b8::b? ([2600:8801:8800:b8::b]) by smtp.gmail.com with ESMTPSA id c15sm12538306pfo.139.2020.04.06.18.11.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2020 18:11:55 -0700 (PDT) From: Guyren Howe X-Mailbutler-Message-Id: 3EF0765A-7E29-4C75-9265-D03EDB83211A Content-Type: multipart/alternative; boundary="Apple-Mail=_147D4ECC-B7B4-4F1E-AEAD-278E8621DA12" Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: How to unnest nested arrays Message-Id: <9BFD1A82-0B06-4B57-A5F4-8525E122B12B@gmail.com> Date: Mon, 6 Apr 2020 18:11:49 -0700 To: "pgsql-general@lists.postgresql.org" X-Mailer: Apple Mail (2.3608.60.0.2.5) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_147D4ECC-B7B4-4F1E-AEAD-278E8621DA12 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Consider this: select (array[array[1, 2], array[3, 4]])[i:i] from generate_subscripts(array[array[1, 2], array[3, 4]], 1) i which produces: {{1,2}} {{3,4}} I expect and want, from that source: {1, 2} {3, 4} These don=E2=80=99t work: select (array[array[1, 2], array[3, 4]])[i:i][:] {{1,2}} {{3,4}} select (array[array[1, 2], array[3, 4]])[i:i][1:1] {{1}} {{3}} Also: could we _please_ get a version of unnest that doesn=E2=80=99t = explode any number of dimensions into 1? --Apple-Mail=_147D4ECC-B7B4-4F1E-AEAD-278E8621DA12 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Consider this:

select (array[array[1, = 2], array[3, = 4]])[i:i]
from = generate_subscripts(array[array[1, 2], = array[3, 4]], = 1) i

which produces:

{{1,2}}
{{3,4}}

I expect and want, from that source:

{1, 2}
{3, 4}

These don=E2=80=99t = work:

select (array[array[1, 2], = array[3, 4]])[i:i][:]
{{1,2}}
{{3,4}}

select = (array[array[1, 2], = array[3, 4]])[i:i][1:1]
{{1}}
{{3}}

Also: could we _please_ get a version of unnest that = doesn=E2=80=99t explode any number of dimensions into = 1?
3D""= --Apple-Mail=_147D4ECC-B7B4-4F1E-AEAD-278E8621DA12--