Inline expansion of inline composite expression I want something like this: 

SELECT 1, (CASE WHEN TRUE THEN (2, 3) ELSE (4, 5) END).*;


...hoping to get 1 | 2 | 3. But in PostgreSQL 11 this query throws:


  ERROR:  record type has not been registered


and without * it obviously returns 1 | (2,3).

Is this possible?
The (2, 3) has type record, i.e. Postgres doesn't know which (or even how many) columns it contains. You can use the .* syntax only with known ("registered") types.

You could define your own tuple type and use that instead of a record:

CREATE TYPE tuple AS (a int, b int);
SELECT 1, (CASE WHEN TRUE THEN '(2, 3)'::tuple ELSE '(4, 5)' END).*;
SELECT 1, (CASE WHEN TRUE THEN (2, 3)::tuple ELSE (4, 5)::tuple END).*;


If you absolutely need to have an expression that returns records, you can cast those to tuples afterwards only by going through a text representation:

SELECT 1, ((CASE WHEN TRUE THEN (2, 3) ELSE (4, 5) END)::text::TUPLE).*;


(online demo)