How can I get the position of a value in PostgreSQL arrays? There\'s .index() method for Python and array_search() function for PHP, but I cannot find any such function for
For integer arrays only you can use the greatly faster idx function from the intarray bundled extension.
This function hasn't been generalized to support all array types yet, unfortunately, so you're stuck with a very slow SQL approach for other arrays.