# DDL and write helpers

> Internal routines invoked by column expressions, sequences and row triggers.

---

LLMS index: [llms.txt](/llms.txt)

---

Internal routines invoked by column expressions, sequences and row triggers.

## auto_increment_advance {#auto_increment_advance}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-auto-increment-advance-a233baaa" href="#mysql-auto-increment-advance-a233baaa">`mysql.auto_increment_advance() → trigger`</a> | Advance the sequence after an explicit AUTO_INCREMENT value. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L68-L69) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L450-L590) |

## column_default {#column_default}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-column-default-pg-catalog-oid-integer-1b4b4133" href="#mysql-column-default-pg-catalog-oid-integer-1b4b4133">`mysql.column_default(oid, integer) → text`</a> | Read a column’s default expression. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L37-L40) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L1651-L1707) |

## generated_column {#generated_column}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-generated-column-pg-catalog-text-pg-catalog-anyelement-b88c136e" href="#mysql-generated-column-pg-catalog-text-pg-catalog-anyelement-b88c136e">`mysql.generated_column(text, anyelement) → anyelement`</a> | Carry a generated-column value through a rewritten expression. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L9-L12) |

## generated_numeric {#generated_numeric}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-generated-numeric-numeric-integer-90ba995d" href="#mysql-generated-numeric-numeric-integer-90ba995d">`mysql.generated_numeric(numeric, integer) → numeric`</a> | Apply the declared type modifier to a generated value. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L32-L35) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L1210-L1249) |

## generated_value {#generated_value}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-generated-value-pg-catalog-anyelement-bcfa1b4b" href="#mysql-generated-value-pg-catalog-anyelement-bcfa1b4b">`mysql.generated_value(anyelement) → anyelement`</a> | Carry a generated-column value through a rewritten expression. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L24-L25) |

## generated_varchar {#generated_varchar}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-generated-varchar-pg-catalog-text-integer-boolean-945fc755" href="#mysql-generated-varchar-pg-catalog-text-integer-boolean-945fc755">`mysql.generated_varchar(text, integer, boolean) → text`</a> | Apply the declared type modifier to a generated value. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L27-L30) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L1180-L1205) |

## lenient_float8 {#lenient_float8}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-lenient-float8-pg-catalog-text-2ac218fc" href="#mysql-lenient-float8-pg-catalog-text-2ac218fc">`mysql.lenient_float8(text) → double precision`</a> | Coerce a value for a non-strict INSERT or UPDATE. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L81-L82) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L877-L883) |

## lenient_int {#lenient_int}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-lenient-int-pg-catalog-text-bigint-bigint-f622a75c" href="#mysql-lenient-int-pg-catalog-text-bigint-bigint-f622a75c">`mysql.lenient_int(text, bigint, bigint) → bigint`</a> | Coerce a value for a non-strict INSERT or UPDATE. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L77-L78) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L794-L822) |

## lenient_numeric {#lenient_numeric}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-lenient-numeric-pg-catalog-text-integer-012db7a0" href="#mysql-lenient-numeric-pg-catalog-text-integer-012db7a0">`mysql.lenient_numeric(text, integer) → numeric`</a> | Coerce a value for a non-strict INSERT or UPDATE. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L79-L80) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L826-L874) |

## lenient_varchar {#lenient_varchar}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-lenient-varchar-pg-catalog-text-integer-b467ae07" href="#mysql-lenient-varchar-pg-catalog-text-integer-b467ae07">`mysql.lenient_varchar(text, integer) → text`</a> | Coerce a value for a non-strict INSERT or UPDATE. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L83-L84) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L887-L905) |

## on_update_current_timestamp {#on_update_current_timestamp}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-on-update-current-timestamp-f2539d1b" href="#mysql-on-update-current-timestamp-f2539d1b">`mysql.on_update_current_timestamp() → trigger`</a> | Update timestamp columns from a row trigger. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L64-L65) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L272-L361) |

## part_list_columns {#part_list_columns}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-part-list-columns-pg-catalog-any-73bf9931" href="#mysql-part-list-columns-pg-catalog-any-73bf9931">`mysql.part_list_columns(VARIADIC "any") → text`</a> | Build a list-partition column key. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L14-L17) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mysm/partListColumns.c#L196-L219) |

## pending_fk_definitions {#pending_fk_definitions}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-pending-fk-definitions-pg-catalog-oid-2b02b412" href="#mysql-pending-fk-definitions-pg-catalog-oid-2b02b412">`mysql.pending_fk_definitions(oid) → SETOF text`</a> | Format deferred foreign key definitions for a child relation. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L46-L58) |

## pending_fk_guard {#pending_fk_guard}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-pending-fk-guard-2bf1eff8" href="#mysql-pending-fk-guard-2bf1eff8">`mysql.pending_fk_guard() → trigger`</a> | Run the trigger for a pending foreign key. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L42-L44) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_fk.c#L615-L629) |

## setval {#setval}

| Signature | Purpose | Source definition |
|---|---|---|
| <a id="mysql-setval-pg-catalog-regclass-bigint-boolean-d791cda3" href="#mysql-setval-pg-catalog-regclass-bigint-boolean-d791cda3">`mysql.setval(regclass, bigint, boolean) → bigint`</a> | Set a sequence value and its called flag. | [SQL](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/sql/baseline/48-func-ddl.sql#L19-L23) · [C](https://github.com/pgsty/pg_mysql/blob/0d51adcf5151ca5c98bc61de84f287ec3b4fe4a3/src/mys_semantics.c#L438-L447) |

---

Backlinks:

- [Functions](/docs/mysql/reference/objects/functions/)
