From: silly sad <sad@bankir.ru>
To: pgsql-sql@postgresql.org
Subject: Re: LIMIT problem
Date: Sat, 01 May 2010 13:05:11 +0400
Message-ID: <4BDBEEC7.5030405@bankir.ru> (raw)
In-Reply-To: <hrfqqn$u2r$1@reversiblemaps.ath.cx>
References: <4BDAD20A.1090503@bankir.ru>
<hrfqqn$u2r$1@reversiblemaps.ath.cx>
On 05/01/10 03:58, Jasen Betts wrote:
> On 2010-04-30, silly sad<sad@bankir.ru> wrote:
>> suppose i request
>>
>> SELECT foo(t.x) FROM t LIMIT 1;
>>
>> Whither it DEFINED how many times foo() will be executed?
>
> foo will be executed repeatedly until it returns a result or all the
> rows in t are exhausted.
>
>> May anyone rely on it?
>
> not sure
>
>> Or we have to avoid this non SQLish trick?
>
>
> This will execute it once (or not at all where t has no rows)
>
> SELECT foo(x) FROM (SELECT x FROM t LIMIT 1) as bar;
>
this subselect "isolation" looks like a safe way.
Unlike LIMITed select looks unpredictable to me.
Thanx for assistance :)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sad@bankir.ru
Subject: Re: LIMIT problem
In-Reply-To: <4BDBEEC7.5030405@bankir.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox