Search Postgresql Archives

Arrays and ANY problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux