X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 678594762C7 for ; Tue, 4 Mar 2003 15:01:14 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 91050-10 for ; Tue, 4 Mar 2003 15:01:12 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 10C344762C4 for ; Tue, 4 Mar 2003 15:01:12 -0500 (EST) Received: from klaster.net (ph228.krakow.cvx.ppp.tpnet.pl [217.99.208.228]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 5B3172B88F; Tue, 4 Mar 2003 20:59:25 +0100 (CET) Message-ID: <3E65061B.9020907@klaster.net> Date: Tue, 04 Mar 2003 21:01:31 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.1) Gecko/20020826 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Ian Burrell Cc: pgsql-sql@postgresql.org Subject: Re: Sorting by NULL values References: <3E65023E.10404@onsitetech.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/135 X-Sequence-Number: 12175 Ian Burrell wrote: > I am doing a query where I need to sort by a column that may be NULL > because it is coming from an OUTER JOIN. I noticed a difference between > PostgreSQL and other databases about where NULLs show up. It seems that > with Postgres, NULLs are sorted after other values. Other databases > sort them before. > > Is there any standard on how sorting NULLs work? Is there a way to > change Postgres's behavior? Is there a way to replace the NULLs with > empty strings? order by field is null asc/desc, field asc/desc Regards, Tomasz Myrta