diff --git a/COMPAT.md b/COMPAT.md index 38d475680..a7baaca83 100644 --- a/COMPAT.md +++ b/COMPAT.md @@ -161,15 +161,6 @@ Feature support of [sqlite expr syntax](https://www.sqlite.org/lang_expr.html). | zeroblob(N) | Yes | | -|-------------------------------------------------| -| LibSql / sqlean Scalar | | | -| ---------------------------- | ------ | ------- | -| uuid4() | Yes | uuid version 4 **uuid's are `blob` by default** | -| uuid4_str() | Yes | uuid v4 string alias `gen_random_uuid()` for PG compatibility| -| uuid7(X?) | Yes | uuid version 7, Optional arg for seconds since epoch| -| uuid7_timestamp_ms(X) | Yes | Convert a uuid v7 to milliseconds since epoch| -| uuid_str(X) | Yes | Convert a valid uuid to string| -| uuid_blob(X) | Yes | Convert a valid uuid to blob| @@ -462,3 +453,16 @@ Feature support of [sqlite expr syntax](https://www.sqlite.org/lang_expr.html). | Variable | No | | VerifyCookie | No | | Yield | Yes | + + + + +| LibSql Compatibility / Extensions| | | +| ---------------------------- | ------ | ------- | +| **UUID** | | UUID's in limbo are `blobs` by default| +| uuid4() | Yes | uuid version 4 | +| uuid4_str() | Yes | uuid v4 string alias `gen_random_uuid()` for PG compatibility| +| uuid7(X?) | Yes | uuid version 7, Optional arg for seconds since epoch| +| uuid7_timestamp_ms(X) | Yes | Convert a uuid v7 to milliseconds since epoch| +| uuid_str(X) | Yes | Convert a valid uuid to string| +| uuid_blob(X) | Yes | Convert a valid uuid to blob| diff --git a/core/translate/expr.rs b/core/translate/expr.rs index 25c986739..ea81d9ead 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -1231,17 +1231,17 @@ pub fn translate_expr( } ScalarFunc::Uuid7 => { let args = match args { - Some(args) if args.len() > 3 => crate::bail_parse_error!( - "{} function with more than 2 arguments", + Some(args) if args.len() > 1 => crate::bail_parse_error!( + "{} function with more than 1 argument", srf.to_string() ), Some(args) => args, None => &vec![], }; let mut start_reg = None; - for arg in args.iter() { + if let Some(arg) = args.first() { let reg = program.alloc_register(); - start_reg = Some(start_reg.unwrap_or(reg)); + start_reg = Some(reg); translate_expr( program, referenced_tables, @@ -1249,6 +1249,9 @@ pub fn translate_expr( reg, precomputed_exprs_to_registers, )?; + if let ast::Expr::Literal(_) = arg { + program.mark_last_insn_constant() + } } program.emit_insn(Insn::Function { constant_mask: 0,