From: | "Jan de Visser" <jdevisser(at)digitalfairway(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | depesz(at)depesz(dot)com, "Sarah Dougherty" <sdougherty(at)desc(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using generate_series to create a unique ID in a query? |
Date: | 2007-11-14 16:27:12 |
Message-ID: | 1159c1e90711140827h2c1cf6d2r9fcab43e90c90105@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 11/14/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> hubert depesz lubaczewski <depesz(at)depesz(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Gauthier, Dave | 2007-11-14 16:31:11 | Re: reserving space in a rec for future update |
Previous Message | Andrew Sullivan | 2007-11-14 16:12:57 | Re: reserving space in a rec for future update |