Re: Arrays and ANY problem

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Arrays and ANY problem
Дата
Msg-id 526FB575-7D50-4D11-A053-8B4B66D5200F@gmail.com
обсуждение исходный текст
Ответ на Re: Arrays and ANY problem  (Alban Hertroys <haramrae@gmail.com>)
Ответы Re: Arrays and ANY problem
Список pgsql-general
> 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’snot 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.




В списке pgsql-general по дате отправления:

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: Arrays and ANY problem
Следующее
От: David Salisbury
Дата:
Сообщение: Re: Arrays and ANY problem