you should be able to cast an id as a string (#2334)

This commit is contained in:
pokeeffe-molecula 2022-12-07 14:27:01 -06:00 committed by GitHub
parent ad350c2d49
commit e599f12ee4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -753,6 +753,8 @@ func typesCanBeCast(sourceType parser.ExprDataType, targetType parser.ExprDataTy
*parser.DataTypeDecimal,
*parser.DataTypeID:
return true
case *parser.DataTypeString:
return true
}
case *parser.DataTypeIDSet:

View file

@ -484,7 +484,14 @@ var castID = TableTest{
SQLs: sqls(
"select _id, cast(id1 as string) from cast_id",
),
ExpErr: "'id' cannot be cast to 'string'",
ExpHdrs: hdrs(
hdr("_id", fldTypeID),
hdr("", fldTypeString),
),
ExpRows: rows(
row(int64(1), string("20")),
),
Compare: CompareExactUnordered,
},
{
SQLs: sqls(