Re: generate_series from now to infinity... - Mailing list pgsql-hackers

From Dickson S. Guedes
Subject Re: generate_series from now to infinity...
Date
Msg-id 1242582655.18964.33.camel@guedes-laptop
Whole thread Raw
In response to Re: generate_series from now to infinity...  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-hackers
Em Dom, 2009-05-17 às 19:22 +0200, hubert depesz lubaczewski escreveu:
> it doesn't for this query:
>
> SELECT i from generate_series(now(), CAST('infinity'::date AS
> timestamp), interval '1 hour') as x (i) limit 3;
>
> which (as far as i understand it) should be the same.
>
> why is it not limiting generate_series in the second example? is it
> intentional?

The EXPLAIN output differ between both.

postgres=# EXPLAIN SELECT generate_series(now(), CAST('infinity'::date
AS timestamp), interval '1 hour') limit 3;                  QUERY PLAN
------------------------------------------------Limit  (cost=0.00..0.02 rows=1 width=0)  ->  Result  (cost=0.00..0.02
rows=1width=0) 


postgres=# explain SELECT i from generate_series(now(),
CAST('infinity'::date AS timestamp), interval '1 hour') as x (i) limit
3;                                  QUERY PLAN
--------------------------------------------------------------------------------Limit  (cost=0.00..0.05 rows=3 width=8)
->  Function Scan on generate_series x  (cost=0.00..17.50 rows=1000 
width=8)


pgsql-hackers by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: generate_series from now to infinity...
Next
From: Tom Lane
Date:
Subject: Re: generate_series from now to infinity...