MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / invalid

Function invalid

crates/expr/src/check.rs:472–541  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

470
471 #[test]
472 fn invalid() {
473 let tx = SchemaViewer(module_def());
474
475 struct TestCase {
476 sql: &'static str,
477 msg: &'static str,
478 }
479
480 for TestCase { sql, msg } in [
481 TestCase {
482 sql: "select * from r",
483 msg: "Table r does not exist",
484 },
485 TestCase {
486 sql: "select * from t where arr = :sender",
487 msg: "The :sender param is an identity",
488 },
489 TestCase {
490 sql: "select * from t where t.a = 1",
491 msg: "Field a does not exist on table t",
492 },
493 TestCase {
494 sql: "select * from t as r where r.a = 1",
495 msg: "Field a does not exist on table t",
496 },
497 TestCase {
498 sql: "select * from t where u32 = 'str'",
499 msg: "Field u32 is not a string",
500 },
501 TestCase {
502 sql: "select * from t where t.u32 = 1.3",
503 msg: "Field u32 is not a float",
504 },
505 TestCase {
506 sql: "select * from t as r where t.u32 = 5",
507 msg: "t is not in scope after alias",
508 },
509 TestCase {
510 sql: "select u32 from t",
511 msg: "Subscriptions must be typed to a single table",
512 },
513 TestCase {
514 sql: "select * from t join s",
515 msg: "Subscriptions must be typed to a single table",
516 },
517 TestCase {
518 sql: "select t.* from t join t",
519 msg: "Self join requires aliases",
520 },
521 TestCase {
522 sql: "select t.* from t join s on t.arr = s.arr",
523 msg: "Product values are not comparable",
524 },
525 TestCase {
526 sql: "select t.* from t join s on t.u32 = r.u32 join s as r",
527 msg: "Alias r is not in scope when it is referenced",
528 },
529 TestCase {

Callers 1

decodeMethod · 0.50

Calls 3

SchemaViewerClass · 0.70
module_defFunction · 0.70
parse_and_type_subFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…