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:59:52
Message-ID: CAM-w4HOXkL1CrSzYK60hhqCSHXuTzUSTEtctRthNoRDKYDBXpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Actually there's nothing about UNION here. It's true for any column alias:

::***> select 'a-c' AS x ORDER BY x COLLATE "C" ;
ERROR: 42703: column "x" does not exist
LINE 2: select 'a-c' AS x ORDER BY x COLLATE "C" ;
^
LOCATION: errorMissingColumn, parse_relation.c:2892
Time: 0.204 ms

Also you don't need WITH, just an old-fashioned inline view:

::***> select * from (select 'a-c'::text AS x) as subquery ORDER BY x
COLLATE "C" ;
┌─────┐
│ x │
├─────┤
│ a-c │
└─────┘
(1 row)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-07-20 22:03:08 Re: Odd error when using UNION and COLLATE
Previous Message David G. Johnston 2016-07-20 21:58:53 Re: Odd error when using UNION and COLLATE