From: | Dennis Björklund <db(at)zigo(dot)dhs(dot)org> |
---|---|
To: | "Magnus Naeslund(f)" <mag(at)fbab(dot)net> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 7.4 Wishlist |
Date: | 2002-12-03 09:20:23 |
Message-ID: | Pine.LNX.4.44.0212031008540.9578-100000@zigo.dhs.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-advocacy pgsql-general pgsql-hackers |
On Tue, 3 Dec 2002, Magnus Naeslund(f) wrote:
> Now convert this query so that it only evaluates the date_part thing
> ONCE:
>
> select t.id, date_part('days',now()-t.stamp) from table_name t where
> date_part('days',now()-t.stamp) > 20;
Something like this could work:
select *
from (select t.id, date_part('days',now()-t.stamp) AS d
from table_name t) AS t1
where t1.d > 20;
That aside I also would like some sort of local names. Something like the
let construct used in many functional languages (not exaclty what you want
above, but still):
let t1 = select * from foo;
t2 = select * from bar;
in select * from t1 natural join t2;
But even though I would like to give name to subexpressions like above, I
still think postgresql should stick to standards as close as possible.
--
/Dennis
From | Date | Subject | |
---|---|---|---|
Next Message | Karel Zak | 2002-12-03 09:45:41 | Re: 7.4 Wishlist |
Previous Message | Tom Lane | 2002-12-03 06:57:59 | Re: 7.4 Wishlist |
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Christian Imbeault | 2002-12-03 09:31:52 | Re: Problem of Null Ordering |
Previous Message | Karel Zak | 2002-12-03 09:13:21 | Re: [GENERAL] One SQL to access two databases. |
From | Date | Subject | |
---|---|---|---|
Next Message | Karel Zak | 2002-12-03 09:45:41 | Re: 7.4 Wishlist |
Previous Message | Dave Page | 2002-12-03 09:19:39 | Re: Shrinkwrap Windows Product, any issues? Anyone? |