Support optional precision for CLOB and BLOB (#639)

* 638 Adjusting CLOB and BLOB with optional precision

* 638 Adding integration tests to increase coverage

* 638 Adjusting BLOB test
This commit is contained in:
AugustoFKL 2022-10-01 18:15:47 -03:00 committed by GitHub
parent 300e28bd85
commit fb5a9747ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 10 deletions

View file

@ -1655,12 +1655,22 @@ fn parse_cast() {
expr_from_projection(only(&select.projection))
);
let sql = "SELECT CAST(id AS CLOB) FROM customer";
let select = verified_only_select(sql);
assert_eq!(
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Clob(None)
},
expr_from_projection(only(&select.projection))
);
let sql = "SELECT CAST(id AS CLOB(50)) FROM customer";
let select = verified_only_select(sql);
assert_eq!(
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Clob(50)
data_type: DataType::Clob(Some(50))
},
expr_from_projection(only(&select.projection))
);
@ -1685,12 +1695,22 @@ fn parse_cast() {
expr_from_projection(only(&select.projection))
);
let sql = "SELECT CAST(id AS BLOB) FROM customer";
let select = verified_only_select(sql);
assert_eq!(
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Blob(None)
},
expr_from_projection(only(&select.projection))
);
let sql = "SELECT CAST(id AS BLOB(50)) FROM customer";
let select = verified_only_select(sql);
assert_eq!(
&Expr::Cast {
expr: Box::new(Expr::Identifier(Ident::new("id"))),
data_type: DataType::Blob(50)
data_type: DataType::Blob(Some(50))
},
expr_from_projection(only(&select.projection))
);