Re: returning row numbers in select

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: returning row numbers in select
Date: 2004-03-10 23:01:44
Message-ID: 13737.1078959704@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca> writes:
>> Couldn't you code this as a WHERE test on the timestamp?

> That would be ideal as it is theoretically possible for there to be
> missing rows due to sampling errors; nevertheless, a WHERE test doesn't
> seem obvious to me. Can you please post an example?

Something like
WHERE (EXTRACT(EPOCH FROM timestamp)::numeric % 5) = 0;
The EXTRACT function returns double precision, but there's no double
modulo operator for some reason, hence the cast to numeric which does
have one.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2004-03-10 23:18:40 Re: returning row numbers in select
Previous Message Randall Skelton 2004-03-10 22:25:49 Re: returning row numbers in select