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
------
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.