SET OPERATIONS: Wrong renaming of second CTE if columns do not match the first CTE by position
Created by: Piiit
The columns of the second CTE get renamed to match the column names of the first. We do this because we want to use the normalizer USING clause to be more concise. Currently we do not match the aliases to the correct positions inside the target list of the second CTE.
Example query that fails:
select a,b,t from e
UNION PERIOD WITH (t,t)
select b,t,a from f;
psql:unibz/tests/test-temporal-setop.sql:84: ERROR: function pg_catalog.lower(integer) does not exist
HINT: No function matches the given name and argument types. You might need to add explicit type casts.