Available in versions: Dev (3.22) | Latest (3.21) | 3.20 | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13

ALTER TYPE .. ADD VALUE

Supported by ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Enum types, such as those created with CREATE TYPE .. AS ENUM, can be extended with new literals. The new literal is added after all the existing literals:

// Adding an enum value to an existing type
create.alterType("type").addValue("new_enum_value").execute();

Dialect support

This example using jOOQ:

alterType("t").addValue("b")

Translates to the following dialect specific expressions:

Aurora Postgres, CockroachDB, Postgres

ALTER TYPE t ADD VALUE 'b'

ASE, Access, Aurora MySQL, BigQuery, ClickHouse, DB2, Databricks, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Trino, Vertica, YugabyteDB

/* UNSUPPORTED */
Generated with jOOQ 3.20. Support in older jOOQ versions may differ. Translate your own SQL on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo