How do I convert a simple select query like select * from customers
into a stored procedure / function in pg?
I'm new to Postgres and create function customers() as returns table/setof
just didn't feel right and thus the question here.
I understand procs are called "functions" in pg land. Thus does not exist and my only options are to either create a view or a function. The issue is create procedure
create function x() returns setof y
returns a paren'd comma separated row of values which can't be used without further processing (at least that's what I'm seeing in pgAdmin and Ruby/Sequel).
create function x() returns table(...)
requires I embed the row definition which I don't want to.
I'm sure there's a reason behind all this but I'm surprised that the most common use case is this tricky.