question abut "order by" null fields

From: Alessandro Vincelli <av(at)alessandro(dot)vincelli(dot)name>
To: pgsql-general(at)postgresql(dot)org
Subject: question abut "order by" null fields
Date: 2005-07-01 09:21:06
Message-ID: 42C50B02.5030404@alessandro.vincelli.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I have 2 table

table1:
id
column1

table2:
id
column2

I perform this query

SELECT column1, column2 FROM table1 LEFT JOIN table2 USING (id)
ORDER BY column1, column2

In the rows where column1 is not null postgres perform ORDER BY column1,
column2

Problem:
In the rows where Column1 is null, postgres don't perform ORDER BY on
the column2

Why?

Same behavior when:

SELECT column1, column2 FROM table1 LEFT JOIN table2 USING (id)
ORDER BY coalesce(column1,''), column2

Thanks in advance

--
-------------------------------
Alessandro Vincelli

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Masse Jacques 2005-07-01 10:30:59 admin library
Previous Message KubaTyszko 2005-07-01 09:05:07 postgres and stored procedures with in/out parameters