From: Alban Hertroys <haramrae@gmail.com>
To: David Salisbury <dsalis@ucar.edu>
Cc: pgsql-general@postgresql.org
Subject: Re: Arrays and ANY problem
Date: Wed, 25 Sep 2019 22:54:49 +0200
Message-ID: <526FB575-7D50-4D11-A053-8B4B66D5200F@gmail.com> (raw)
In-Reply-To: <775E048E-4316-4AFE-B4A7-A25AC79DE002@gmail.com>
References: <CAKXTjVmV+mHXvzCKtKuHeooYYObNQhST7eG7kJmUcJy7=1cqTg@mail.gmail.com>
<775E048E-4316-4AFE-B4A7-A25AC79DE002@gmail.com>
> On 25 Sep 2019, at 22:50, Alban Hertroys <haramrae@gmail.com> wrote:
>
>
>> On 25 Sep 2019, at 22:25, David Salisbury <dsalis@ucar.edu> wrote:
>> db=# select name from table_name_ds_tmp where ARRAY[categoryid] = ANY ( select string_to_array( '200,400', ',')::bigint[] );
>> name
>> ------
>> (0 rows)
>
> You are comparing two arrays for equality. Since the left-hand array has only 1 item and the right-hand one has two, there’s not much equality between them.
>
> You probably meant:
> select name from table_name_ds_tmp where categoryid = ANY ( select string_to_array( '200,400', ',')::bigint[] );
Or rather:
select name from table_name_ds_tmp where categoryid = 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.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: haramrae@gmail.com, dsalis@ucar.edu
Subject: Re: Arrays and ANY problem
In-Reply-To: <526FB575-7D50-4D11-A053-8B4B66D5200F@gmail.com>
References: <CAKXTjVmV+mHXvzCKtKuHeooYYObNQhST7eG7kJmUcJy7=1cqTg@mail.gmail.com> <775E048E-4316-4AFE-B4A7-A25AC79DE002@gmail.com> <526FB575-7D50-4D11-A053-8B4B66D5200F@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox