Available in versions: Dev (3.21)
This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
ALTER TABLE .. ALTER COLUMN .. SET GENERATED
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
A column GENERATED expression can be added to a computed column using the ALTER TABLE's SET GENERATED clause on a column:
// Specify a new generated expression for a computed column
create.alterTable("table").alter("column").setGeneratedAlwaysAs(1).execute();
Dialect support
This example using jOOQ:
alterTable("t").alter("c").setGeneratedAlwaysAs(1)
Translates to the following dialect specific expressions:
Aurora Postgres, Postgres
ALTER TABLE t ALTER c SET EXPRESSION AS (1)
DB2
BEGIN
EXECUTE IMMEDIATE '
SET INTEGRITY FOR t OFF
';
EXECUTE IMMEDIATE '
ALTER TABLE t ALTER c SET EXPRESSION AS (1)
';
EXECUTE IMMEDIATE '
SET INTEGRITY FOR t IMMEDIATE CHECKED FORCE GENERATED
';
END
Firebird
ALTER TABLE t ALTER c GENERATED ALWAYS AS (1)
ASE, Access, Aurora MySQL, BigQuery, ClickHouse, CockroachDB, Databricks, DuckDB, Exasol, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Spanner, Sybase, Teradata, Trino, Vertica, YugabyteDB
/* UNSUPPORTED */
Generated with jOOQ 3.21. 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!