How many columns can I have in an ORDER BY clause?

From: Mary Anderson <maryfran(at)demog(dot)berkeley(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: How many columns can I have in an ORDER BY clause?
Date: 2010-02-26 01:11:41
Message-ID: 4B871FCD.5000605@demog.berkeley.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I have a query that has an ORDER BY clause that appears to break.
It has 12 or 13 columns. Have I exceeded postgresql's sorting capacity?

Here is my query:
BIG_SELECT_cmd = SELECT

value,x.d15_dv_id,x.d5_dv_id,x.dm1_dv_id,x.dm2_dv_id,x.d8_dv_id,x.d12_dv_id,v.data_batch_id

FROM display.perm_tmp_xprod_table_550 x LEFT JOIN
display.perm_tmp_data_values_550 v
ON x.d15_dv_id = v.d15_dv_id
AND x.d5_dv_id = v.d5_dv_id
AND x.dm1_dv_id = v.dm1_dv_id
AND x.dm2_dv_id v.dm2_dv_id
AND x.d8_dv_id = v.d8_dv_id
AND x.d12_dv_id =v.d12_dv_id

ORDER BY
x.d15_group_order,x.d15_value_rank,
x.d5_group_order,x.d5_value_rank,
x.dm1_group_order,x.dm1_value_rank,
x.dm2_group_order,x.dm2_value_rank,
x.d8_group_order,x.d8_value_rank,
x.d12_group_order,x.d12_value_rank,
v.DMEM_status,
'2050-01-01'::DATE - v.data_batch_created_date

I checked the underlying tables. They seem to be reasonable -- no nulls
But the dm1 values and the dm2 values do not sort at all.

Mary

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2010-02-26 01:29:52 Re: How many columns can I have in an ORDER BY clause?
Previous Message Andrej 2010-02-25 20:35:59 Re: Importing lines of variable length from ASCII