1

I have a function which returns a SETOF text, currently it is returned with the same name as the function.

Is it possible to alias the result returned?

Using an alias will allow me to map the results to a property using Dapper without the need for a custom mapper class.

I've tried to return a single column table but the performance when doing that is 10X slower.

2
  • How did you measure that? Can you show both functions? Commented Mar 2, 2020 at 7:00
  • For me I wanted a way to rename jsonb_each.key and jsonb_each.value in SELECT jsonb_each.* FROM foo, jsonb_each(bar) Commented Nov 4, 2021 at 22:17

1 Answer 1

1

You can assign any name to the result column by using an alias:

SELECT myfun AS othername FROM myfun();

or

SELECT * FROM myfun() AS myfun(othername);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.