1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Allow an "IntReal" value to count as a REAL when checking types for

insertion into a generated column on a STRICT table.
[forum:/forumpost/fa012c77796d9399|Forum post fa012c77796d9399].

FossilOrigin-Name: 1ec44d55da2ced1a1b0b78b489caff628652464f5709ee827e35409eb20ea794
This commit is contained in:
drh
2022-01-17 23:37:25 +00:00
parent 14818366c7
commit 1f3366cd68
4 changed files with 38 additions and 9 deletions

View File

@@ -2986,6 +2986,8 @@ case OP_TypeCheck: {
break;
}
case COLTYPE_REAL: {
testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_Real );
testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_IntReal );
if( pIn1->flags & MEM_Int ){
/* When applying REAL affinity, if the result is still an MEM_Int
** that will fit in 6 bytes, then change the type to MEM_IntReal
@@ -3003,7 +3005,7 @@ case OP_TypeCheck: {
pIn1->flags |= MEM_Real;
pIn1->flags &= ~MEM_Int;
}
}else if( (pIn1->flags & MEM_Real)==0 ){
}else if( (pIn1->flags & (MEM_Real|MEM_IntReal))==0 ){
goto vdbe_type_error;
}
break;