mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 11:17:23 +00:00
Support BIT column types (#1577)
This commit is contained in:
parent
e16b24679a
commit
6d4188de53
4 changed files with 41 additions and 0 deletions
|
@ -12440,3 +12440,22 @@ fn test_reserved_keywords_for_identifiers() {
|
|||
let sql = "SELECT MAX(interval) FROM tbl";
|
||||
dialects.parse_sql_statements(sql).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_table_with_bit_types() {
|
||||
let sql = "CREATE TABLE t (a BIT, b BIT VARYING, c BIT(42), d BIT VARYING(43))";
|
||||
match verified_stmt(sql) {
|
||||
Statement::CreateTable(CreateTable { columns, .. }) => {
|
||||
assert_eq!(columns.len(), 4);
|
||||
assert_eq!(columns[0].data_type, DataType::Bit(None));
|
||||
assert_eq!(columns[0].to_string(), "a BIT");
|
||||
assert_eq!(columns[1].data_type, DataType::BitVarying(None));
|
||||
assert_eq!(columns[1].to_string(), "b BIT VARYING");
|
||||
assert_eq!(columns[2].data_type, DataType::Bit(Some(42)));
|
||||
assert_eq!(columns[2].to_string(), "c BIT(42)");
|
||||
assert_eq!(columns[3].data_type, DataType::BitVarying(Some(43)));
|
||||
assert_eq!(columns[3].to_string(), "d BIT VARYING(43)");
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue