If you’re getting a PostgreSQL error that reads something like “cannot subscript type text because it does not support subscripting” when selecting data from a database, it’s probably because you’re trying to perform some sort of array operation against a non array value.
The above error specifically mentions text data but we could get the same error when using a different data type, like an integer, character varying, etc.
To fix this issue, be sure to run the array operations against actual arrays. If working with non array data, then don’t use array operations against that data.
Continue reading