Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfWai-0007l4-9j for pgsql-general@arkaria.postgresql.org; Mon, 24 Jun 2019 21:33:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hfWag-0005vA-WF for pgsql-general@arkaria.postgresql.org; Mon, 24 Jun 2019 21:33:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfWag-0005v3-Gy for pgsql-general@lists.postgresql.org; Mon, 24 Jun 2019 21:33:30 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hfWae-0005xL-6I for pgsql-general@postgresql.org; Mon, 24 Jun 2019 21:33:29 +0000 Received: by mail-pl1-x629.google.com with SMTP id b7so7630461pls.6 for ; Mon, 24 Jun 2019 14:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=YsHdPX8VB3rWy7szUTgGI/bgme1+8Mz/uEnM0GwxX/Y=; b=Fz7OcM2yqs/RMhrtP6svZAYS6kDQq2VxzHOjpyOAKbw+bZ7P+X/dfSotfuD8Whx39G F7V1NI/O90yBm6H1YRNr9jtGeZDOFvy6MLR/beYqPc+zD5Fn52k2PURidRjXHNRbSsN9 oyJW1z1YdyEiXFZKVX0I/tiBkE0oSSkUsdQ2Wl06dRA4bkx2173P0ow88UDkfq9kBldB YDDJHPM0ynochtz3iAy+lVgn68840prwcXk2pcrp0bV6ywzpto922Lgol/7e30F6Ktly X58iD1fijA4NCqhRT/e9MeqngRVpUfNNhj9S4pZth42rxpNn42/Nfuv+L7D3vdaGqxl7 UL3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=YsHdPX8VB3rWy7szUTgGI/bgme1+8Mz/uEnM0GwxX/Y=; b=C1w1dY9zqpM03mwb3OXwiyKBzZA8r1+MYsectgx5fkopRATYZf1w1loiN2f04QoY12 QhAWBHJYGw3DNuOMrLyPv+jz10PnmQwQUiBf98cZfks3GgqS9KoWhW/n/bIv0pVCGhQZ gQFIiISLDJ+rjVmP0O3ow9e90jS7qaN6QjD8lRSU7igylqJ6JoEARpBl9NeXw3RbuDT8 HvjgFzpObKiglVUr0T+ry2MElD5gRxogfdhGxTQ3e2rmb9aTJ4rWsdPIFLF4OJIcHC4w LO/l3gfAo60p0u49pr+XcLSyXEtkyCqc7RhSGUX5uddh0lr4/pO7SQg3TBtse1sSjh52 Hhvw== X-Gm-Message-State: APjAAAWx7ex5KPxxeV3XKciVLJysZKoD+U3QaNo0dlIDx640gSMFXuNY UAuexhTN4kjvoxXtyqvIk6c= X-Google-Smtp-Source: APXvYqwMDUDfabsqomg2FR+Z2YCJDMZeNDfU1J1lw6oSfn11fdVyRFLlc+mAKE/TNsF0qNem1oS08Q== X-Received: by 2002:a17:902:583:: with SMTP id f3mr87177226plf.137.1561412006814; Mon, 24 Jun 2019 14:33:26 -0700 (PDT) Received: from [10.106.129.203] ([155.100.47.3]) by smtp.gmail.com with ESMTPSA id n2sm10682230pgp.27.2019.06.24.14.33.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 14:33:25 -0700 (PDT) From: Rob Sargent Message-Id: <163793B6-8981-4618-9770-0AFD4D499728@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_CE5C4A12-8AAC-41EA-AF0C-F579BFA7485D" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Coalesce 2 Arrays Date: Mon, 24 Jun 2019 15:33:24 -0600 In-Reply-To: Cc: "pgsql-general@postgresql.org" To: Alex Magnum References: X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_CE5C4A12-8AAC-41EA-AF0C-F579BFA7485D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Jun 24, 2019, at 2:31 PM, Alex Magnum = wrote: >=20 > Hi, > I have two arrays which I need to combine based on the individual = values; > i could do a coalesce for each field but was wondering if there is an = easier way >=20 > array_a{a, null,c, d,null,f,null} primary > array_b{null,2 ,null,4,5 ,6,null} secondary > =20 > result {a, 2, c, d,5, f,null) >=20 > Any advice would be appreciated >=20 Are the inputs always of fixed dimensions eg. 1 by 7? --Apple-Mail=_CE5C4A12-8AAC-41EA-AF0C-F579BFA7485D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Jun 24, 2019, at 2:31 PM, Alex Magnum <magnum11200@gmail.com> wrote:

Hi,
I have two arrays which I need to combine = based on the individual values;
i could do a coalesce for = each field but was wondering if there is an easier way

array_a{a,   null,c,  =  d,null,f,null}  primary
array_b{null,2  =  ,null,4,5   ,6,null}  secondary
 
result {a,   2,   c,  =  d,5,   f,null)

Any advice would = be appreciated

Are the inputs always of fixed dimensions eg. 1 = by 7?

= --Apple-Mail=_CE5C4A12-8AAC-41EA-AF0C-F579BFA7485D--