Re: 7.4 Wishlist - Mailing list pgsql-hackers

From Dennis Björklund
Subject Re: 7.4 Wishlist
Date
Msg-id Pine.LNX.4.44.0212031008540.9578-100000@zigo.dhs.org
Whole thread Raw
In response to Re: 7.4 Wishlist  ("Magnus Naeslund(f)" <mag@fbab.net>)
Responses Re: 7.4 Wishlist
List 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 t1where 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



pgsql-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: Shrinkwrap Windows Product, any issues? Anyone?
Next
From: Karel Zak
Date:
Subject: Re: 7.4 Wishlist