Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f22DQUx07270 for ; Fri, 2 Mar 2001 08:26:30 -0500 (EST) (envelope-from pgsql-general-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1S3xjx51987 for ; Tue, 27 Feb 2001 22:59:45 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f1S3VuS53031 for pgsql-general@postgresql.org; Tue, 27 Feb 2001 22:31:56 -0500 (EST) (envelope-from news) From: Ian Harding X-Newsgroups: comp.databases.postgresql.general, comp.databases.postgresql.questions Subject: Re: Is this a bug? Date: Tue, 27 Feb 2001 19:38:33 -0800 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 58 Message-ID: <3A9C72B9.AFE5A145@pakrat.com> References: <3A9C3AEE.BBF70529@pumpkinnet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.12-20 i686) X-Accept-Language: en To: pgsql-general@postgresql.org X-Archive-Number: 200103/74 X-Sequence-Number: 5513 Limin Liu wrote: > Hi, > > Can anyone please tell me whether this is a bug or not? > > I used the following SQL to create my table and view with some data. > > ======================= > create table tbl (no int, cnt int); > create view tbl_view as > select no, count(cnt) as count > from tbl > group by no > having count(cnt) > 2; > insert into tbl values(1, 1); > insert into tbl values(1, 2); > insert into tbl values(1, 3); > insert into tbl values(1, 4); > insert into tbl values(2, 1); > insert into tbl values(2, 2); > insert into tbl values(2, 3); > ======================= > > Here is soem SQL I issued; first one looks fine to me, but the second > one is weird. > > ======================= > db=> select * from tbl_view; > no | count > ----+------- > 1 | 4 > 2 | 3 > (2 rows) > > db=> select * from tbl_view where count > 5; > no | count > ----+------- > 1 | 4 > 2 | 3 > (2 rows) > > db2=> > ======================= > > Thanx > > LM.Liu I get ERROR: Rewrite: Aggregate of views only allowed on single tables for now I think it may have something to do with the reserved sql keyword 'count' being used. Ian