Re: [SQL] LIMIT problem

2010-05-01 Thread silly sad

On 04/30/10 16:57, Nilesh Govindarajan wrote:

On 04/30/2010 06:20 PM, silly sad wrote:

suppose i request

SELECT foo(t.x) FROM t LIMIT 1;

Whither it DEFINED how many times foo() will be executed?

May anyone rely on it?
Or we have to avoid this non SQLish trick?



It will execute foo only once, and give only one row out of the n rows
it returns. If I'm wrong please correct me.


I did not asked how many times foo() would be executed.

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] LIMIT problem

2010-05-01 Thread silly sad

On 05/01/10 03:58, Jasen Betts wrote:

On 2010-04-30, silly sad  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 :)

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] regexp_replace and search/replace values stored in table

2010-05-01 Thread Leif Biberg Kristensen
Followup II: I've written a blog post on the subject at 
.
 
regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql