X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7F449DAF4F for ; Wed, 26 Oct 2005 05:35:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94031-04 for ; Wed, 26 Oct 2005 08:35:22 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id B6AB8DAF3A for ; Wed, 26 Oct 2005 05:35:23 -0300 (ADT) Received: from mainbox.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 4A0604085A0; Wed, 26 Oct 2005 09:35:20 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 5334315EDA; Wed, 26 Oct 2005 09:31:51 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03220-04; Wed, 26 Oct 2005 09:31:48 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id B3D1815ED5; Wed, 26 Oct 2005 09:31:48 +0100 (BST) Message-ID: <435F3EF4.7010808@archonet.com> Date: Wed, 26 Oct 2005 09:31:48 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: chester c young Cc: pgsql-sql@postgresql.org Subject: Re: broken join optimization? (8.0) References: <20051025235612.20767.qmail@web54301.mail.yahoo.com> In-Reply-To: <20051025235612.20767.qmail@web54301.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 required=5 tests=[AWL=0.009, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/313 X-Sequence-Number: 23166 chester c young wrote: > in php (for example) it's frequently nice to get the structure of a > table without any data, ie, pull a single row with each attribute's > value is null. I use the query (dual is a table of one row ala > Oracle): > > select m.* from dual > left join mytable m on( false ); Out of curiosity, why do it this way? Does "rownum" not get set if there are no rows returned? Actually, even if it doesn't why not use: SELECT * FROM mytable WHERE true=false Surely your client interface returns the types/column-names then? It should - that's a set of 0 rows. -- Richard Huxton Archonet Ltd