分别从数组中获取元素

This topic may have already been posted, but i didn't find it ...

With postgresql, i return an array with a function i made :

Select * from my_function(var1,var2);

And i got the expected result :

{x,y}

By using php (pg_fetch_array($result)), i also manage to get this result in this form. What i would like to get, now, is x and y separately. Like this

{x},{y}

Is that possible ? I wanted to know how can i get element one by one from an array ?

It sounds like you want a resultset. You can do this in SQL with unnest:

SELECT unnested.elem 
FROM my_function(var1,var2) f(arr),
     unnest(f.arr) unnested(elem);