macro/inline table valued functions

Started by Bret Greenover 15 years ago2 messagesgeneral
Jump to latest
#1Bret Green
bret.green@yahoo.com

Is there anything like a macro or an inline table valued function in postgres?
i.e I define a query as a function/macro and reuse the function in queries and
the dbms will expand the function/macro to its definition, thus avoiding any
overhead.

If not what is the closest thing?

Thanks

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bret Green (#1)
Re: macro/inline table valued functions

Bret Green <bret.green@yahoo.com> writes:

Is there anything like a macro or an inline table valued function in postgres?

Recent versions can inline SQL-language functions, if they consist of
a simple SELECT and meet a few other constraints. I think the main
nonobvious constraint is they should be marked STABLE and not STRICT.

regards, tom lane