diff --git a/lib/src/sql/statements/define.rs b/lib/src/sql/statements/define.rs index fa28a1bf..93d149aa 100644 --- a/lib/src/sql/statements/define.rs +++ b/lib/src/sql/statements/define.rs @@ -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)?; diff --git a/lib/tests/define.rs b/lib/tests/define.rs index 42d75fde..bbeb0a0b 100644 --- a/lib/tests/define.rs +++ b/lib/tests/define.rs @@ -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 = "