|
9 | 9 | *
|
10 | 10 | *
|
11 | 11 | * IDENTIFICATION
|
12 |
| - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.266 2007/12/01 23:44:44 tgl Exp $ |
| 12 | + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.267 2007/12/20 00:23:19 tgl Exp $ |
13 | 13 | *
|
14 | 14 | *-------------------------------------------------------------------------
|
15 | 15 | */
|
@@ -769,25 +769,28 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, bool showTblSpc,
|
769 | 769 | keycoltype = exprType(indexkey);
|
770 | 770 | }
|
771 | 771 |
|
772 |
| - /* Add the operator class name */ |
| 772 | + /* Provide decoration only in the colno=0 case */ |
773 | 773 | if (!colno)
|
| 774 | + { |
| 775 | + /* Add the operator class name, if not default */ |
774 | 776 | get_opclass_name(indclass->values[keyno], keycoltype, &buf);
|
775 | 777 |
|
776 |
| - /* Add options if relevant */ |
777 |
| - if (amrec->amcanorder) |
778 |
| - { |
779 |
| - /* if it supports sort ordering, report DESC and NULLS opts */ |
780 |
| - if (opt & INDOPTION_DESC) |
781 |
| - { |
782 |
| - appendStringInfo(&buf, " DESC"); |
783 |
| - /* NULLS FIRST is the default in this case */ |
784 |
| - if (!(opt & INDOPTION_NULLS_FIRST)) |
785 |
| - appendStringInfo(&buf, " NULLS LAST"); |
786 |
| - } |
787 |
| - else |
| 778 | + /* Add options if relevant */ |
| 779 | + if (amrec->amcanorder) |
788 | 780 | {
|
789 |
| - if (opt & INDOPTION_NULLS_FIRST) |
790 |
| - appendStringInfo(&buf, " NULLS FIRST"); |
| 781 | + /* if it supports sort ordering, report DESC and NULLS opts */ |
| 782 | + if (opt & INDOPTION_DESC) |
| 783 | + { |
| 784 | + appendStringInfo(&buf, " DESC"); |
| 785 | + /* NULLS FIRST is the default in this case */ |
| 786 | + if (!(opt & INDOPTION_NULLS_FIRST)) |
| 787 | + appendStringInfo(&buf, " NULLS LAST"); |
| 788 | + } |
| 789 | + else |
| 790 | + { |
| 791 | + if (opt & INDOPTION_NULLS_FIRST) |
| 792 | + appendStringInfo(&buf, " NULLS FIRST"); |
| 793 | + } |
791 | 794 | }
|
792 | 795 | }
|
793 | 796 | }
|
|
0 commit comments