X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3AB0DB43376 for ; Mon, 7 Jul 2003 15:45:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 32536-05 for ; Mon, 7 Jul 2003 12:45:21 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 44016B43183 for ; Mon, 7 Jul 2003 12:45:21 -0300 (ADT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by www.postgresql.com (Postfix) with ESMTP id BB458CF6FE1 for ; Mon, 7 Jul 2003 12:45:20 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 19ZY9p-00072H-0V; Mon, 07 Jul 2003 16:44:01 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 69F6817A26; Mon, 7 Jul 2003 16:44:00 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id B84201647D; Mon, 7 Jul 2003 16:43:59 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Gary Stainburn , pgsql-sql@postgresql.org Subject: Re: Concat and view - Re: create view error Date: Mon, 7 Jul 2003 16:44:01 +0100 User-Agent: KMail/1.4.3 References: <200307071240.23936.gary.stainburn@ringways.co.uk> <200307071534.20970.dev@archonet.com> <200307071610.25690.gary.stainburn@ringways.co.uk> In-Reply-To: <200307071610.25690.gary.stainburn@ringways.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307071644.01371.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/68 X-Sequence-Number: 14182 On Monday 07 Jul 2003 4:10 pm, Gary Stainburn wrote: > On Monday 07 Jul 2003 3:34 pm, Richard Huxton wrote: > > Don't do "select *" do "select field_a,field_b..." - the * doesn't just > > refer to the locos table. > > Sorry if I didn't make myself plain enough, but I had > > create view loco_dets as > select * from locos l -- includes lid which I want > left outer join > (select lnid, lnumber.......) ln on ln.lnid =3D l.lid > ....... > > The problem is that I have to have lnid in the sub-select to allow the 'o= n' > clause to work, but I don't want lnid to appear in the resulting view. Yep, so don't do "SELECT *", list the fields you want instead. The * in tha= t=20 second line applies to the rest of the query, not just the "locos" table. There is something to be said for a format such as "SELECT * EXCEPT lnid" b= ut=20 I don't think it's mentioned in any sql spec. --=20 Richard Huxton