1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Always disallow functions as the DEFAULT of a column. Add assert()s and

FossilOrigin-Name: a991bb1a9eb54bdbd45bd623e8b304bdfeb481a3
This commit is contained in:
drh
2015-03-12 21:02:36 +00:00
parent 81367381a9
commit 96f4ad20fd
5 changed files with 30 additions and 27 deletions

View File

@@ -690,9 +690,10 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
*/
if( pDflt ){
sqlite3_value *pVal = 0;
if( pDflt->op!=TK_FUNCTION
&& sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_NONE, &pVal)
){
int rc;
rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_NONE, &pVal);
assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
if( rc!=SQLITE_OK ){
db->mallocFailed = 1;
return;
}