Hi,

> >> CREATE INDEX test_desc_idx1
> >>   ON test_desc
> >>   USING btree
> >>   (f1, f2 desc)
> >>
> >> CREATE INDEX test_desc_idx2
> >>   ON test_desc
> >>   USING btree
> >>   (f1 desc, f2);
>
> postgres=# select pg_get_indexdef('test_desc_idx1'::regclass, 2, true);
>  pg_get_indexdef
> -----------------
>  f2 DESC
> (1 row)
>
> postgres=# select pg_get_indexdef('test_desc_idx2'::regclass, 2, true);
>  pg_get_indexdef
> -----------------
>  DESCf2
> (1 row)
>
> Looks like pg_get_indexdef is unwell :-(


yes, it was unwell in the area where the amcanorder was being processed. The
attached patch should fix this.

Regards,
Nikhils
-- 
EnterpriseDB               http://www.enterprisedb.com
Index: src/backend/utils/adt/ruleutils.c
===================================================================
RCS file: /repositories/postgreshome/cvs/pgsql/src/backend/utils/adt/ruleutils.c,v
retrieving revision 1.266
diff -c -r1.266 ruleutils.c
*** src/backend/utils/adt/ruleutils.c	1 Dec 2007 23:44:44 -0000	1.266
--- src/backend/utils/adt/ruleutils.c	19 Dec 2007 11:11:17 -0000
***************
*** 779,793 ****
  			/* if it supports sort ordering, report DESC and NULLS opts */
  			if (opt & INDOPTION_DESC)
  			{
! 				appendStringInfo(&buf, " DESC");
! 				/* NULLS FIRST is the default in this case */
! 				if (!(opt & INDOPTION_NULLS_FIRST))
! 					appendStringInfo(&buf, " NULLS LAST");
  			}
  			else
  			{
! 				if (opt & INDOPTION_NULLS_FIRST)
! 					appendStringInfo(&buf, " NULLS FIRST");
  			}
  		}
  	}
--- 779,799 ----
  			/* if it supports sort ordering, report DESC and NULLS opts */
  			if (opt & INDOPTION_DESC)
  			{
! 				if (!colno || colno == keyno + 1)
! 				{
! 					appendStringInfo(&buf, " DESC");
! 					/* NULLS FIRST is the default in this case */
! 					if (!(opt & INDOPTION_NULLS_FIRST))
! 						appendStringInfo(&buf, " NULLS LAST");
! 				}
  			}
  			else
  			{
! 				if (!colno || colno == keyno + 1)
! 				{
! 					if (opt & INDOPTION_NULLS_FIRST)
! 						appendStringInfo(&buf, " NULLS FIRST");
! 				}
  			}
  		}
  	}
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to