Re: auto-increment in a view - Mailing list pgsql-general

From Willy-Bas Loos
Subject Re: auto-increment in a view
Date
Msg-id 1dd6057e0909031003g3cc29977wec23c9942f010c1a@mail.gmail.com
Whole thread Raw
In response to Re: auto-increment in a view  (Raymond O'Donnell <rod@iol.ie>)
List 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

pgsql-general by date:

Previous
From: Adam Rich
Date:
Subject: Re: auto-increment in a view
Next
From: Edoardo Panfili
Date:
Subject: add a value to an ENUM type