Alvaro Herrera <alvherre@atentus.com> writes:
>> I am new to PostgreSQL and databases in general, and I have this
>> question: why it is not possible to specify ordering when creating an
>> index?
> Because there is no point in doing so. Postgres automatically scans an
> index in reverse direction if you want to use descending order.
But he wants, or says he wants, ASC order on the first column and DESC
on the second. I concur with Martijn that this might just be a
beginner's mistake in giving the command ... but if that's really what
he wants then it doesn't correspond to either forward or reverse scan
of a normal index. You would indeed need to make a custom opclass for
the second column in order to make an index that can be scanned in this
order.
regards, tom lane