Re: Odd error when using UNION and COLLATE

From: Greg Stark <stark(at)mit(dot)edu>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Odd error when using UNION and COLLATE
Date: 2016-07-20 21:55:38
Message-ID: CAM-w4HN7bOXnhVQzbf_Tmt5kh+6XJbHD9aM87jZhJTQN29b=Rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 20, 2016 at 10:38 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> SELECT 'a-c' AS x UNION ALL SELECT 'ab' AS x ORDER BY x COLLATE "C";

::***> select 'a-c' COLLATE "C" AS x UNION ALL SELECT 'ab' AS x ORDER BY x ;
┌─────┐
│ x │
├─────┤
│ a-c │
│ ab │
└─────┘
(2 rows)

But I think I agree that it's surprising that the collate clause isn't
working in the ORDER BY on a column produced by a UNION. Certainly
that's where people usually want to put it.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-07-20 21:58:53 Re: Odd error when using UNION and COLLATE
Previous Message Bruce Momjian 2016-07-20 21:38:21 Odd error when using UNION and COLLATE