Written by Sean Behan on Thu Sep 26th 2013

If you have an string of numbers like

"1,2,3"

and you want to turn it into an array of integers you need to cast it into an integer array type.

"{1,2,3}"::int[]

This is commonly used together when grabbing a set using the ANY clause.

select * from users where id = any('{1,2,3}'::int[])

Tagged with..
#Postgres #types #databases #sql

Just finishing up brewing up some fresh ground comments...