From: | David Salisbury <dsalis(at)ucar(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Arrays and ANY problem |
Date: | 2019-09-25 20:25:15 |
Message-ID: | CAKXTjVmV+mHXvzCKtKuHeooYYObNQhST7eG7kJmUcJy7=1cqTg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Perhaps someone can guide me here as I'm having a "moment". :)
Not sure why I am getting 0 rows returned here:
db=# \d table_name_ds_tmp
Column | Type | Modifiers
------------+-------------------+-----------
categoryid | bigint |
name | character varying |
db=# select * from table_name_ds_tmp;
categoryid | name
------------+-------
100 | one
200 | two
300 | three
400 | four
(4 rows)
db=# select name from table_name_ds_tmp where ARRAY[categoryid] = ANY (
select string_to_array( '200,400', ',')::bigint[] );
name
------
(0 rows)
I would expect, and am in need of, the query returning these 2 rows,
"two"
"four"
which I plan to aggregate together later on with array_to_string.
Basically I hope to take a string and substitute the values in it with
their associated values.
Other incantations and permutations just seem to give me various error
messages.
Thanks for any help.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Lewis | 2019-09-25 20:48:22 | Re: Arrays and ANY problem |
Previous Message | PegoraroF10 | 2019-09-25 20:14:23 | Re: Operator is not unique |