How many columns can I have in an ORDER BY clause? - Mailing list pgsql-novice

From Mary Anderson
Subject How many columns can I have in an ORDER BY clause?
Date
Msg-id 4B871FCD.5000605@demog.berkeley.edu
Whole thread Raw
Responses Re: How many columns can I have in an ORDER BY clause?
Re: How many columns can I have in an ORDER BY clause?
List 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

pgsql-novice by date:

Previous
From: Andrej
Date:
Subject: Re: Importing lines of variable length from ASCII
Next
From: Tom Lane
Date:
Subject: Re: How many columns can I have in an ORDER BY clause?