Re: 7.2.1: coalesce double-calls function?

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: 7.2.1: coalesce double-calls function?
Дата
Msg-id Pine.LNX.4.33.0302041219130.27245-100000@leary.csoft.net
обсуждение исходный текст
Ответ на Re: 7.2.1: coalesce double-calls function?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

On Fri, 24 Jan 2003, Tom Lane wrote:

> "=?iso-8859-2?B?U1rbQ1MgR+Fib3I=?=" <surrano@mailbox.hu> writes:
> > CONCLUSION: I think both the optimizer, both the side effects would be
> > happier if all of COALESCE's expressions were only calculated once.
>
> Yup, and NULLIF too.  Want to submit a patch?  Look for CaseExpr in the
> sources, copy/paste/modify.
>

I have been looking at this and the NULLIF case seems complicatd.
Essentially for NULLIF(left,right) I want to ExecEvalExpr(left,...)
and construct a Const node with the result.  Then makeSimpleA_Expr for
const left = right.  Evaluate that and if not true return the already
evaluated left side otherwise NULL.

This seems to merge all phases from parse to execution into the execution
phase.  How can I evaluate an expression and then construct a new
expression with that result in a clean manner?

Kris Jurka




В списке pgsql-general по дате отправления:

Предыдущее
От: dcpatel@hss.hns.com (D C Patel)
Дата:
Сообщение: Setting rule on COPY command
Следующее
От: Medi Montaseri
Дата:
Сообщение: AllocSetAlloc() error message