Default to true for WHEN on DEFINE EVENT statement (#4662)
This commit is contained in:
parent
4145f70463
commit
99356dcd49
2 changed files with 28 additions and 0 deletions
|
@ -3,6 +3,7 @@ use reblessive::Stk;
|
||||||
use crate::cnf::EXPERIMENTAL_BEARER_ACCESS;
|
use crate::cnf::EXPERIMENTAL_BEARER_ACCESS;
|
||||||
use crate::sql::access_type::JwtAccessVerify;
|
use crate::sql::access_type::JwtAccessVerify;
|
||||||
use crate::sql::index::HnswParams;
|
use crate::sql::index::HnswParams;
|
||||||
|
use crate::sql::Value;
|
||||||
use crate::{
|
use crate::{
|
||||||
sql::{
|
sql::{
|
||||||
access_type,
|
access_type,
|
||||||
|
@ -738,6 +739,7 @@ impl Parser<'_> {
|
||||||
let mut res = DefineEventStatement {
|
let mut res = DefineEventStatement {
|
||||||
name,
|
name,
|
||||||
what,
|
what,
|
||||||
|
when: Value::Bool(true),
|
||||||
if_not_exists,
|
if_not_exists,
|
||||||
overwrite,
|
overwrite,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -344,6 +344,32 @@ async fn define_statement_event() -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Confirms that a DEFINE EVENT with no WHERE clause will produce WHEN true
|
||||||
|
#[tokio::test]
|
||||||
|
async fn define_statement_event_no_when_clause() -> Result<(), Error> {
|
||||||
|
let sql = "
|
||||||
|
DEFINE EVENT some_event ON TABLE user THEN {};
|
||||||
|
INFO FOR TABLE user;
|
||||||
|
";
|
||||||
|
let mut t = Test::new(sql).await?;
|
||||||
|
//
|
||||||
|
t.skip_ok(1)?;
|
||||||
|
let val = Value::parse(
|
||||||
|
"{
|
||||||
|
events: {
|
||||||
|
some_event: 'DEFINE EVENT some_event ON user WHEN true THEN { }'
|
||||||
|
},
|
||||||
|
fields: {},
|
||||||
|
indexes: {},
|
||||||
|
lives: {},
|
||||||
|
tables: {}
|
||||||
|
}",
|
||||||
|
);
|
||||||
|
t.expect_value(val)?;
|
||||||
|
//
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn define_statement_event_when_event() -> Result<(), Error> {
|
async fn define_statement_event_when_event() -> Result<(), Error> {
|
||||||
let sql = "
|
let sql = "
|
||||||
|
|
Loading…
Reference in a new issue