Referencing function value inside CASE..WHEN - Mailing list pgsql-general

From lover boi
Subject Referencing function value inside CASE..WHEN
Date
Msg-id BLU155-W1661F2D893B14654AED26CD56F0@phx.gbl
Whole thread Raw
Responses Re: Referencing function value inside CASE..WHEN
Re: Referencing function value inside CASE..WHEN
Re: Referencing function value inside CASE..WHEN
List pgsql-general
Hi,

In the following statement, does the custom function get executed twice?

SELECT
  MY_FUNCTION(...),
  CASE WHEN MY_FUNCTION(...) = '...' THEN '...' ELSE '...' END
...
...


If so, is there a way I can make it execute once?  I tried this but it gave me a "Column my_function does not exist" error.

SELECT

  MY_FUNCTION(...) AS my_function,

  CASE WHEN my_function = '...' THEN '...' ELSE '...' END

...

...


Thank you in advance.

pgsql-general by date:

Previous
From: Dave Thompson
Date:
Subject: fill factor guestimate
Next
From: Scott Marlowe
Date:
Subject: Re: fill factor guestimate