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

Earlier detection of a host of errors in CREATE TABLE, such the CREATE TABLE

statement itself fails, rather than generating an error on the first attempted
use of the created table.

FossilOrigin-Name: 348fa7aaf7958b3fb689ed023d946064ae8d92718a497a346e95114a2410cbf5
This commit is contained in:
drh
2023-10-13 22:19:23 +00:00
parent cc67a62fa0
commit 9132b8816a
5 changed files with 30 additions and 12 deletions

View File

@@ -2921,12 +2921,16 @@ void sqlite3EndTable(
sqlite3VdbeAddParseSchemaOp(v, iDb,
sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0);
/* Test for cycles in generated columns */
/* Test for cycles in generated columns and illegal expressions
** in CHECK constraints and in DEFAULT clauses. */
if( p->tabFlags & TF_HasGenerated ){
sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0,
sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%s\"",
sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0,
sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%w\"",
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
}
sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0,
sqlite3MPrintf(db, "PRAGMA \"%w\".integrity_check(%Q)",
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
}
/* Add the table to the in-memory representation of the database.