diff options
author | drh <> | 2023-03-08 14:28:09 +0000 |
---|---|---|
committer | drh <> | 2023-03-08 14:28:09 +0000 |
commit | 06af03d70a6466210ca6ad99a73aef5cc3d3c118 (patch) | |
tree | 315507ebf35f84f1a07ac8c3de89fd162db70889 /src | |
parent | 248c1abdf4c61bf0761994db40c214272a092c7c (diff) | |
parent | bacb8aeb3502017b907729a0774785af28887407 (diff) | |
download | sqlite-06af03d70a6466210ca6ad99a73aef5cc3d3c118.tar.gz sqlite-06af03d70a6466210ca6ad99a73aef5cc3d3c118.zip |
Change to [44135d6ea84f7ba6] that retains the historical datatype ("INT", not "NUM") for a table created as follows: "CREATE TABLE t1 AS SELECT CAST(123 AS INT) AS value;". The use of FLEXNUM only occurs on compound queries.
FossilOrigin-Name: 6d5b5896261c62a7e130b47416ee8c25793859a2afcb1646c257600537a5b71b
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c index efa8b301f..7e8592524 100644 --- a/src/select.c +++ b/src/select.c @@ -2332,8 +2332,6 @@ void sqlite3SubqueryColumnTypes( pCol->affinity = sqlite3ExprAffinity(p); if( pCol->affinity<=SQLITE_AFF_NONE ){ pCol->affinity = aff; - }else if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){ - pCol->affinity = SQLITE_AFF_FLEXNUM; } if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){ int m = 0; @@ -2347,6 +2345,9 @@ void sqlite3SubqueryColumnTypes( if( pCol->affinity>=SQLITE_AFF_NUMERIC && (m&0x02)!=0 ){ pCol->affinity = SQLITE_AFF_BLOB; } + if( pCol->affinity>=SQLITE_AFF_NUMERIC && p->op==TK_CAST ){ + pCol->affinity = SQLITE_AFF_FLEXNUM; + } } zType = columnType(&sNC, p, 0, 0, 0); if( zType==0 || pCol->affinity!=sqlite3AffinityType(zType, 0) ){ |