VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

How to cast a string of comma separated numbers into an array of integers for Postgres

       

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 w/ #postgres #types #databases #sql