pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: chester c young <chestercyoung@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: broken join optimization? (8.0)
Date: Wed, 26 Oct 2005 09:31:48 +0100
Message-ID: <435F3EF4.7010808@archonet.com> (raw)
In-Reply-To: <20051025235612.20767.qmail@web54301.mail.yahoo.com>
References: <20051025235612.20767.qmail@web54301.mail.yahoo.com>

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



view thread (7+ messages)  latest in thread

Message-ID: <435F3EF4.7010808@archonet.com>
Permalink:  ../435F3EF4.7010808@archonet.com/
Also on:    postgresql.org/message-id/435F3EF4.7010808@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, chestercyoung@yahoo.com
  Subject: Re: broken join optimization? (8.0)
  In-Reply-To: <435F3EF4.7010808@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox