Support BIT column types (#1577)

This commit is contained in:
Michael Victor Zink 2024-12-03 16:47:12 -08:00 committed by GitHub
parent e16b24679a
commit 6d4188de53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 0 deletions

View file

@ -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!(),
}
}