On 11/14/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> hubert depesz lubaczewski <depesz@depesz.com> writes:
> > On Mon, Nov 12, 2007 at 03:11:50PM -0800, Sarah Dougherty wrote:
> >> To recap with an example, the query below works fine, but how do I add a
> >> series to it?
>
> > generate_series will not help with this.
> > try the sequence approach, or this:
> > http://www.depesz.com/index.php/2007/08/17/rownum-anyone-cumulative-sum-in-one-query/
>
> That's a fairly ugly/messy way of doing it. If you're going to need a C
> function anyway, why not just do it directly? As in the attachment.
>
> regression=# create function rownum() returns int as '/home/tgl/pgsql/rownum'
> regression-# language c;
> CREATE FUNCTION
Any reason why this couldn't appear in the core of some future
version? I've been wanting something like this a couple of times
before. Note that Oracle has it as well.
jan