> I am trying to create an expression which > - always yield true if the incomming array is NULL > - yields true if a given value is in the array, otherwise yields false > > I thought this should work: > Select 'target'=ANY(COALESCE('{indata1, indata2}','{target}')) > > but I get an ERROR: op ANY/ALL (array) requires array on right side > Can somebody tell me what I am doing wrong and how to do this right? Read up on array input syntax (http://www.postgresql.org/docs/current/static/arrays.html). What you are giving as input to your coalesce above are two strings, not two arrays. Try this: select 'target' = any(coalesce('{"indata1","target"}'::text[], '{"target"}'::text[])); I personally find the ARRAY syntax more intuitive: select 'target' = any(coalesce(array['indata1','indata2'], array['target'])); This will work as i think you expect it to. Note that array behavior with respect to nulls changed with 8.2 so whether "incomming array is NULL" will differ depend on your version. ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly