Re: Let-bindings in SQL statements

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Let-bindings in SQL statements
Date: 2012-02-11 10:42:15
Message-ID: jh5gm7$mrl$5@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2012-01-26, David Johnston <polobo(at)yahoo(dot)com> wrote:

> Is it possible to do the equivalent of let-bindings in a pure SQL function?
> I have a SELECT that invokes "now" multiple times.  It would be nicer to do
> it only once and reuse the value.  Something like this:

There is no need. now() is tagged as stable. it will only be executed once.

the planner will figure this out for you.

--
⚂⚃ 100% natural

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2012-02-11 10:44:31 Re: Let-bindings in SQL statements
Previous Message Jasen Betts 2012-02-11 10:37:17 Re: last entry per person