Find a string within an array column in PostgreSQL Find a string within an array column in PostgreSQL arrays arrays

Find a string within an array column in PostgreSQL


Might this:

select ...   from ...  where ...        and array_to_string(authors, ', ') like '%123456789%';`

do the trick?

Otherwise, there is the unnest function...

The "Array Functions and Operators" chapter has more details.


The ANY() function can do the job for you:

SELECT * FROM people WHERE '123456789' = ANY(authors);

Given people.authors is of type text[].