MySQL: a virtual or generated column makes the insert fail ("value specified for generated column is not allowed", S1000)

Applies to: Clarion 10 (2020 thread) and Clarion 11 EE (2022 thread) with the ODBC driver; MySQL with virtual generated columns and, in the second thread, a server reported as "MySQL 10.3" with ODBC 8.0.29, auto-increment on the server.

Problem

A column created with GENERATED ALWAYS AS (reverse(pad)) VIRTUAL imported into the dictionary without trouble, and its values showed in a browse. Adding a record from the standard form failed with The value specified for generated column 'reverse_pad' in table 'sbtest1' is not allowed (S1000). A second poster had a generated column used for a name locator and the same failure on adding a record; HeidiSQL and MySQL Workbench inserted fine. Ticking Read Only on the column in the dictionary was not enough. Deleting the column from the dictionary avoided the error.

Solution

  1. In the dictionary, open the column's Attributes and put the READONLY driver switch in the External Name, with spaces around the pipe: reverse_pad | READONLY.
  2. The driver then neither inserts nor updates that column, while the browse still reads it.
  3. Both posters reported the problem solved. The help topic is "READONLY driver switch" (ODBC Accelerator driver, SQL column properties).

Caveats

  • A trace log gave nothing beyond the error message; deleting an index on the column had no effect.
  • One reply suspected Clarion's autoinc inserting an empty record; the poster found that was not the issue.
  • Only MySQL was tested in these threads.

Today (2026)

Likely unchanged, since the switch is documented; not re-tested here.

Sources: Pierre-Jean Q. (Apr 2020, the question), Graham D., Geoff, Mike D., Sean H. (Apr 2020); Ramon H. (Aug 2022, the question), Arnor B., Geoff (Aug 2022) in softvelocity.clarion.databasedrivers.