Re: ExecMakeTableFunctionResult vs. pre-evaluated functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ExecMakeTableFunctionResult vs. pre-evaluated functions
Date: 2002-12-01 20:29:52
Message-ID: 29186.1038774592@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Joe Conway <mail(at)joeconway(dot)com> writes:
>> If presented with a non-function-call expression tree, can we always evaluate
>> it to produce a scalar constant (if it isn't already)? If so, why not do that,
>> create a one row, one column tuplestore, and exit? It's really no different
>> than a function call that does the same, is it?

> Yeah, that's probably a reasonable approach to take. It would fail if
> we had an expression that returned a non-scalar value (viz. a set),
> but the constant-folder won't try to fold or inline anything that
> returns a set, so you shouldn't see any problem in practice.

Actually, it turns out to be easy to make ExecMakeTableFunctionResult
cope with expressions returning sets as well. It's the same as the
ValuePerCall protocol we defined for table functions (no surprise,
since that protocol was deliberately modeled on the existing
implementation of set-returning expressions). So it's done.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hans-Jürgen Schönig 2002-12-01 21:25:37 Why not add PostGIS to the core?
Previous Message Tom Lane 2002-12-01 19:25:04 Re: ExecMakeTableFunctionResult vs. pre-evaluated functions