Add support SCHEMAFUL keyword spelling

Closes #115
This commit is contained in:
Tobie Morgan Hitchcock 2022-09-11 09:08:36 +01:00
parent a8497ff6b3
commit f90eb542bd
2 changed files with 42 additions and 1 deletions

View file

@ -695,7 +695,14 @@ pub enum DefineTableOption {
}
fn table_opts(i: &str) -> IResult<&str, DefineTableOption> {
alt((table_drop, table_view, table_schemaless, table_schemafull, table_permissions))(i)
alt((
table_drop,
table_view,
table_schemaless,
table_schemafull,
table_schemaful,
table_permissions,
))(i)
}
fn table_drop(i: &str) -> IResult<&str, DefineTableOption> {
@ -722,6 +729,12 @@ fn table_schemafull(i: &str) -> IResult<&str, DefineTableOption> {
Ok((i, DefineTableOption::Schemafull))
}
fn table_schemaful(i: &str) -> IResult<&str, DefineTableOption> {
let (i, _) = shouldbespace(i)?;
let (i, _) = tag_no_case("SCHEMAFUL")(i)?;
Ok((i, DefineTableOption::Schemafull))
}
fn table_permissions(i: &str) -> IResult<&str, DefineTableOption> {
let (i, _) = shouldbespace(i)?;
let (i, v) = permissions(i)?;

View file

@ -141,6 +141,34 @@ async fn define_statement_table_schemafull() -> Result<(), Error> {
Ok(())
}
#[tokio::test]
async fn define_statement_table_schemaful() -> Result<(), Error> {
let sql = "
DEFINE TABLE test SCHEMAFUL;
INFO FOR DB;
";
let dbs = Datastore::new("memory").await?;
let ses = Session::for_kv().with_ns("test").with_db("test");
let res = &mut dbs.execute(&sql, &ses, None, false).await?;
assert_eq!(res.len(), 2);
//
let tmp = res.remove(0).result;
assert!(tmp.is_ok());
//
let tmp = res.remove(0).result?;
let val = Value::parse(
"{
dl: {},
dt: {},
sc: {},
tb: { test: 'DEFINE TABLE test SCHEMAFULL' },
}",
);
assert_eq!(tmp, val);
//
Ok(())
}
#[tokio::test]
async fn define_statement_event() -> Result<(), Error> {
let sql = "