0

I have a table with an unknown amount of rows, let's say

-----
geom
-----
0123
3216
6549
...

And a function that returns table:

> select * from myFunc('line(1 2, 3 4, 5 6)'::geometry);
----------
val1 val2
----------
10   98
75   65

So I want to call this function for each row in the table above and union them. How do I do this?

1 Answer 1

1

If myFunc is a set-returning function, you can move it from the FROM part to the SELECT part, while referencing each member of the set returning record type that you want.

SELECT the_table_with_geom.some_primary_key,
       (myFunc(geom)).val1, (myFunc(geom)).val2
FROM the_table_with_geom;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.