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 1iDEJL-0005pa-Lf for pgsql-general@arkaria.postgresql.org; Wed, 25 Sep 2019 20:54:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDEJK-0006Tr-IP for pgsql-general@arkaria.postgresql.org; Wed, 25 Sep 2019 20:54:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDEJK-0006Rm-8S for pgsql-general@lists.postgresql.org; Wed, 25 Sep 2019 20:54:54 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDEJH-0000QX-Vc for pgsql-general@postgresql.org; Wed, 25 Sep 2019 20:54:53 +0000 Received: by mail-ed1-x52a.google.com with SMTP id h2so14172edn.3 for ; Wed, 25 Sep 2019 13:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=dzT9goci6atyihIIjlWBDQqP+4kUwcBqMjXLxOobJ9Q=; b=F3409xmPKz59+tZsutMxRRek8kBd/d7gnbf+UorJbGs9Esq3tZZ8aLdzb2FBzNvsVn Qi/RulzP/FQj0O6WgcPcL6tSaBoW9hpnvE3h5+ji56M0byA+j7tcl4TWj6AZDwbbbsdW 0XylIjVkLv4pgjem+FZb5sTe/wdl4Sd+MLycaET92kO5/k/Mi0DPyhgjpJvMrSQv+oa0 3VSmkTaRPKgQ6hfKp4Ji/27XZX3oGK9dyUmCOIL1cY3b2nUXKWZ67CDTcdQIFa66kcNH U5RRNFL5+fPoRnsI3Zzu9IUFLuRynptwtI1UXek/HV4RqfJUv1erDraPJeJH8Cdkb3P4 MG5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=dzT9goci6atyihIIjlWBDQqP+4kUwcBqMjXLxOobJ9Q=; b=FE2s6I6uFQ4hQxhH8I/H3vjRDHPZMg76mFg1M6Gzuz5sqLaUp3y/01JKtvHrySPPjP m0sQ1oJ/IYCJJ6FOsLvT1Box2XOX62iL692xuADtIxKEmjAu+JvUZM1pYvd9xYcdoVAQ OtG2+WxPA86uWVM2raWg0bQSTHYyM0m6wvQPKcY6RtC7bXY42Y7xWhzGic8X4B286Jef MwLnY89o9GVl1CPW/GOLQI3fwg4inKdpni56H2BIwvpJWwSfyvLkRJy0sCk75uuVAM5o xLDW3KfHleS56rdhczfpsNi6WUCYQk7FOtXLRPP68lbVg2e4b8k0FVUm9+pQUxya1soD wSxA== X-Gm-Message-State: APjAAAXjoIBXagc5CG1axF+sLSLwjhKiemRobduqLpyHMQUsdZMy8cYh /mUjgJeinozFSzddBlxDBtU= X-Google-Smtp-Source: APXvYqyzT+RmMskm4n370+TBejMJZgUb3DV8atNBt2aM7D//IXYJB29e860hEx1bHyRTs+RIySKBHA== X-Received: by 2002:a17:906:3286:: with SMTP id 6mr86455ejw.37.1569444891160; Wed, 25 Sep 2019 13:54:51 -0700 (PDT) Received: from hollewijn.internal (217-19-30-105.dsl.cambrium.nl. [217.19.30.105]) by smtp.gmail.com with ESMTPSA id f21sm21747edt.52.2019.09.25.13.54.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2019 13:54:50 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Arrays and ANY problem From: Alban Hertroys In-Reply-To: <775E048E-4316-4AFE-B4A7-A25AC79DE002@gmail.com> Date: Wed, 25 Sep 2019 22:54:49 +0200 Cc: pgsql-general@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <526FB575-7D50-4D11-A053-8B4B66D5200F@gmail.com> References: <775E048E-4316-4AFE-B4A7-A25AC79DE002@gmail.com> To: David Salisbury X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On 25 Sep 2019, at 22:50, Alban Hertroys wrote: >=20 >=20 >> On 25 Sep 2019, at 22:25, David Salisbury wrote: >> db=3D# select name from table_name_ds_tmp where ARRAY[categoryid] =3D = ANY ( select string_to_array( '200,400', ',')::bigint[] ); >> name=20 >> ------ >> (0 rows) >=20 > You are comparing two arrays for equality. Since the left-hand array = has only 1 item and the right-hand one has two, there=E2=80=99s not much = equality between them. >=20 > You probably meant: > select name from table_name_ds_tmp where categoryid =3D ANY ( select = string_to_array( '200,400', ',')::bigint[] ); Or rather: select name from table_name_ds_tmp where categoryid =3D ANY ( = string_to_array( '200,400', ',')::bigint[] ); Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.