Re: auto-increment in a view

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: rod(at)iol(dot)ie, adam(dot)r(at)sbcglobal(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: auto-increment in a view
Date: 2009-09-03 17:03:07
Message-ID: 1dd6057e0909031003g3cc29977wec23c9942f010c1a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Just a wild notion, but would the generate_series function be any use to
> you?

Good idea, but i can't get it to work.

create or replace view testview3 as (
select generate_series(1,(select count(*) from test group by "value")), value
from test group by value);
select * from testview3 limit 5;
--ERROR: more than one row returned by a subquery used as an expression

When i put the generate_series in the FROM clause, the results will be
matched "everything to everything".

I guess the windowing function is the way to go.

Thx,

WBL

--
"Patriotism is the conviction that your country is superior to all
others because you were born in it." -- George Bernard Shaw

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2009-09-03 17:17:15 column level, uid based authorization to update columns
Previous Message Edoardo Panfili 2009-09-03 16:52:09 add a value to an ENUM type