amazon-redshift

How to select list of VALUES in redshift?


The following query works in Postgresql but not in Redshift:

WITH bar (baz) AS
    (VALUES ('a'), ('b'), ('c'))
SELECT * from bar;

Which gives

baz
---
a
b
c

How can I replicate this behaviour in Redshift?


Solution

  • unfortunately UNION is the only way here:

    WITH bar (baz) AS
    (select 'a' union select 'b' union select 'c')
    SELECT * from bar;