views containing aggregates - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject views containing aggregates
Date
Msg-id 200008270331.e7R3VGB21463@hub.org
Whole thread Raw
List pgsql-bugs
NAGY Andras (nagya@inf.elte.hu) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
views containing aggregates

Long Description
Not sure, whether the `Views containing aggregates sometimes fail' and `Allow views of aggregate columns' entries from
theTODO cover this, therefore the bug report.  An aggregate select from a view containing aggregates behaves
differentlyas expected.  Even if the support for this is on TODO, until fixing this, postgres should print a warning or
otherwisereject such use of views. 

Sample Code
create table example (
   name  text
);
insert into example values('alpha');
insert into example values('alpha');
insert into example values('alpha');
insert into example values('alpha');
insert into example values('beta');
insert into example values('beta');
insert into example values('gamma');

-- the following should always return the number
-- of rows a simple `select * from relation' would return

select count(*) from example;
 count
-------
     7
(1 row)


create view example_view as select name from example group by name;
select * from example_view;
 name
-------
 alpha
 beta
 gamma
(3 rows)

-- however, it is not the case here

select count(*) from example_view;
 count
-------
     4
     2
     1
(3 rows)



No file was uploaded with this report

pgsql-bugs by date:

Previous
From: "Gabor Z. Papp"
Date:
Subject: Error: unknown type 'ame'
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: CREATE VIEW does not work from within plpgsql