Skip to content

Support SELECT * EXCEPT / EXCLUDE #26969

@zack-prefix

Description

@zack-prefix

Hello! Apologies if I'm misunderstanding the current implementation, but is this example supported in exclude_columns() table function?

with
my_cte as (
select
1 as a,
2 as b,
3 as c
)

select
*,
c + 2 as c
from table(exclude_columns(
input => table(my_cte),
columns => descriptor(c)
)) as excluded

Trying to return below without ambiguous column errors or duplicated columns:
a b c
1 2 5

If you use the table function here, you don't have access to 'c' for the calculation and would need to join back to the first CTE (assuming you have a unique primary key, if not you're out of luck) or you have to list explicit columns which is hard to scale as a solution for tables with more dynamic schemas.

With Select * Except it would look like this:

with
my_cte as (
select
1 as a,
2 as b,
3 as c
)

select * except (x),
x + 2 as x
from my_cte

Thank you and appreciate any thoughts or suggestions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions