The correct Postgres syntax is:
SELECT * FROM ( VALUES (1) ) AS q (col1);
Missing set of parentheses.
But it seems that Redshift does not even support the expression VALUES outside INSERT (as modern Postgres does). So for one line :
SELECT * FROM ( SELECT 1 ) AS q (col1);
For multiple rows (without using UNION ALL as requested) you can use a temporary table. Note ( for documentation ):
The temporary table is automatically discarded at the end of the session in which it was created.
CREATE TEMP TABLE q(col1 int); INSERT INTO q(col1) VALUES (1), (2), (3); SELECT * FROM q;
If UNION ALL would be an option:
SELECT 1 AS col1 UNION ALL SELECT 2 UNION ALL SELECT 3;
source share