Re: COALESCE implementation question

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)hub(dot)org
Subject: Re: COALESCE implementation question
Date: 2000-08-06 04:12:38
Message-ID: 3.0.5.32.20000806141238.01ec9580@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 23:28 5/08/00 -0400, Tom Lane wrote:
>Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
>>> Well, the standard is perfectly clear, isn't it? If V(1) has side
>>> effects then trying to optimize this into just one evaluation of V(1)
>>> will generate non-spec-compliant results.
>
>> At least with the new function manager, if I feel te need I can write a
>> 'CoalesceValues' function (at least for fixed numbers of parameters).
>
>Mmm ... not really. You could detect nulls all right, but a function-
>based version of COALESCE would evaluate *all* its arguments exactly
>once, which is certainly wrong.

Good point. Although in the specific case (two args, one of them constant),
it's not an issue. I guess I'll just have to live with double-evaluation,
and a COALESCE than can return NULL. Grumble grumble...

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Swan 2000-08-06 04:14:52 Re: LIKE/ESCAPE implementation
Previous Message Tom Lane 2000-08-06 04:10:10 Re: LIKE/ESCAPE implementation