SQL
Example
Create a table with a `UNION` column:  
```sql
CREATE TABLE tbl1 (u UNION(num INTEGER, str VARCHAR));
INSERT INTO tbl1 values (1), ('two'), (union_value(str := 'three'));
```  
Any type can be implicitly cast to a `UNION` containing the type. Any `UNION` can also be implicitly cast to another `UNION` if the source `UNION` members are a subset of the target's (if the cast is unambiguous).  
`UNION` uses the member types' `VARCHAR` cast functions when casting to `VARCHAR`:  
```sql
SELECT u FROM tbl1;
```  
|   u   |
|-------|
| 1     |
| two   |
| three |  
Select all the `str` members:  
```sql
SELECT union_extract(u, 'str') AS str
FROM tbl1;
```  
|  str  |
|-------|
| NULL  |
| two   |
| three |  
Alternatively, you can use 'dot syntax' similarly to [`STRUCT`s](#docs:sql:data_types:struct).  
```sql
SELECT u.str
FROM tbl1;
```  
|  str  |
|-------|
| NULL  |
| two   |
| three |  
Select the currently active tag from the `UNION` as an `ENUM`.  
```sql
SELECT union_tag(u) AS t
FROM tbl1;
```  
|  t  |
|-----|
| num |
| str |
| str |