Documentation

    union_tag

    Retrieve the currently selected tag of the union as an ENUM.

    Try an expression

    In Formula, enter the expression and set Output type to VARCHAR.

    Expression

    union_tag(union_value(k := 'foo'))

    Result

    'k'

    The expression returns ENUM('k'). Formula stores it as VARCHAR in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.

    Arguments and types

    union_tag(union)
    union
    Union
    Supported signatures (1)
    union_tag(union: UNION) → ANY

    The result type can depend on the input types. See DuckDB for the full argument rules.

    Browse unionsDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.