Skip to content
Advertisement

query has no destination for result data, select functions names from schema

I am trying to turn select into function, but keep getting error: “query has no destination for result data”. Select returns 5 columns so I am trying to return table with 5 columns. I can not figure out what I am missing, please help!

Advertisement

Answer

As the error message suggests, you have to tell the function what to return. To return a table bases on a query use RETURN QUERY, e.g.

And call it like this:

So, assuming your query is correct, the function should look like this:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement