Re: Odd error when using UNION and COLLATE - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Odd error when using UNION and COLLATE
Date
Msg-id CAM-w4HOXkL1CrSzYK60hhqCSHXuTzUSTEtctRthNoRDKYDBXpg@mail.gmail.com
Whole thread Raw
In response to Re: Odd error when using UNION and COLLATE  (Greg Stark <stark@mit.edu>)
List 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)



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Odd error when using UNION and COLLATE
Next
From: Tom Lane
Date:
Subject: Re: Odd error when using UNION and COLLATE