Re: Using generate_series to create a unique ID in a query?
От | Jan de Visser |
---|---|
Тема | Re: Using generate_series to create a unique ID in a query? |
Дата | |
Msg-id | 1159c1e90711140827h2c1cf6d2r9fcab43e90c90105@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Using generate_series to create a unique ID in a query? (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Using generate_series to create a unique ID in a query?
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: