Re: [SQL] Does IMMUTABLE property propagate?

2010-03-24 Thread Louis-David Mitterrand
On Sat, Mar 06, 2010 at 04:31:55PM -0500, Tom Lane wrote: > Petru Ghita writes: > > "..immediately replaced with the function value" doesn't mean that the > > results of a previously evaluated function for the same parameters are > > stored and reused? > > No, it means what it says: the function

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Josh Kupershmidt
On Wed, Mar 24, 2010 at 2:38 PM, John Gage wrote: > In going through the arcana of string functions, I have come across the > following series of selects that contain, for me, a mysterious "$re$". > > -- return all matches from regexp > SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$)

Re: [SQL] window function to sort times series data?

2010-03-24 Thread John Gage
In going through the arcana of string functions, I have come across the following series of selects that contain, for me, a mysterious "$re$". -- return all matches from regexp SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$); -- test case insensitive SELECT regexp_matches('foObARbEq

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Louis-David Mitterrand
On Wed, Mar 24, 2010 at 05:29:46PM +0100, Andreas Kretschmer wrote: > A. Kretschmer wrote: > > Well, and now i'm using 8.4 windowing-functions: > > test=*# select * from price order by price_id, d; > price_id | price | d > --+---+ > 1 |10 | 2010-03-12 >

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Andreas Kretschmer
A. Kretschmer wrote: Well, and now i'm using 8.4 windowing-functions: test=*# select * from price order by price_id, d; price_id | price | d --+---+ 1 |10 | 2010-03-12 1 |11 | 2010-03-19 1 |12 | 2010-03-26 1 |13 | 2010-

Re: [SQL] window function to sort times series data?

2010-03-24 Thread A. Kretschmer
In response to Louis-David Mitterrand : > On Wed, Mar 24, 2010 at 03:29:36PM +0100, A. Kretschmer wrote: > > In response to Louis-David Mitterrand : > > > Hi, > > > > > > I have time series data: price(id_price int, price int, created_on > > > timestamp) > > > > > > I'd like to select the latest

Re: [SQL] window function to sort times series data?

2010-03-24 Thread Louis-David Mitterrand
On Wed, Mar 24, 2010 at 03:29:36PM +0100, A. Kretschmer wrote: > In response to Louis-David Mitterrand : > > Hi, > > > > I have time series data: price(id_price int, price int, created_on > > timestamp) > > > > I'd like to select the latest price before, say, 2010-03-10 and the > > latest price

Re: [SQL] window function to sort times series data?

2010-03-24 Thread A. Kretschmer
In response to Louis-David Mitterrand : > Hi, > > I have time series data: price(id_price int, price int, created_on timestamp) > > I'd like to select the latest price before, say, 2010-03-10 and the > latest price after that date. test=*# select * from price ; id_price | price | created_on

[SQL] window function to sort times series data?

2010-03-24 Thread Louis-David Mitterrand
Hi, I have time series data: price(id_price int, price int, created_on timestamp) I'd like to select the latest price before, say, 2010-03-10 and the latest price after that date. Using "group by" and self-joins I was able to build a (quite large :) working query. But I wonder if there is a cl