Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id CB5F09FB4E0 for ; Thu, 29 Mar 2007 04:01:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 79333-04 for ; Thu, 29 Mar 2007 04:01:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 17B029FA4AE for ; Thu, 29 Mar 2007 04:01:26 -0300 (ADT) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 69A6776B16; Thu, 29 Mar 2007 07:49:40 +0100 (BST) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 113BA274136; Thu, 29 Mar 2007 07:49:32 +0100 (BST) Message-ID: <460B617B.4010005@archonet.com> Date: Thu, 29 Mar 2007 07:49:31 +0100 From: Richard Huxton User-Agent: IceDove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: Phillip Smith Cc: pgsql-sql@postgresql.org Subject: Re: SELECT INSTEAD References: <00ab01c771c4$1ec9aa50$9b0014ac@wbaus090> In-Reply-To: <00ab01c771c4$1ec9aa50$9b0014ac@wbaus090> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/345 X-Sequence-Number: 27983 Phillip Smith wrote: > > I'm trying to create a view of the query below, but I'm being barked at > about "rules on SELECT must have action INSTEAD SELECT". I don't have any > rules in my database, and I don't know how this query is trying to create > one. The query does work if I just run it interactively. Any help would be > much appreciated. You have two queries here - which one is giving the problem? > SELECT DISTINCT ON (m1.id) ... > ; > > SELECT d.id AS "ID", ... > ; -- Richard Huxton Archonet Ltd