Re: broken join optimization? (8.0)

From: Richard Huxton <dev(at)archonet(dot)com>
To: chester c young <chestercyoung(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: broken join optimization? (8.0)
Date: 2005-10-26 08:31:48
Message-ID: 435F3EF4.7010808@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2005-10-26 09:05:51 converting epoch to timestamp
Previous Message Patrick JACQUOT 2005-10-26 07:53:52 Re: automatic update or insert