1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-24 08:21:29 +03:00

Immediately fail a CREATE TABLE statement that attempts to create a

table that has a generated column loop.  Legacy allows the table to be
created but the table would not be usable for anything.

FossilOrigin-Name: 3237bf964117c1ef71143042837ef21872bb3d04bfd682075672e768953ec802
This commit is contained in:
drh
2023-10-13 13:49:46 +00:00
parent 9817065340
commit af527231c1
5 changed files with 26 additions and 15 deletions

View File

@@ -2920,6 +2920,13 @@ void sqlite3EndTable(
/* Reparse everything to update our internal data structures */
sqlite3VdbeAddParseSchemaOp(v, iDb,
sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0);
/* Test for cycles in generated columns */
if( p->tabFlags & TF_HasGenerated ){
sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0,
sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%s\"",
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
}
}
/* Add the table to the in-memory representation of the database.