fsprojects / Rezoom.SQL

Statically typechecks a common SQL dialect and translates it to various RDBMS backends
MIT License
669 stars 25 forks source link

No compile time error when using Inner Join without On #22

Closed rkosafo closed 6 years ago

rkosafo commented 7 years ago

When an inner join is written without on, it does not fail at compile time but rather give a runtime error like Incorrect syntax near ';'..

Using the default model and tsql,

module Tests =
  let print = printf "Output: %A"

  type InnerJoinWithoutOn = SQL<"""
    Select *
    From Users u
    Inner Join Comments c --ON is missing """>
  let innerJoinWithoutOn () = 
    use ctx = new ConnectionContext ()
    InnerJoinWithoutOn.Command().Execute (ctx) |> print

It will be nice if this can fail at compile time instead of at runtime.

rspeele commented 7 years ago

This is actually legal syntax in SQLite, but it does seem pretty pointless, so it might as well be an error on all backends.

rspeele commented 7 years ago

a178ba7c922f55685c40bfbdfde0f96e9921aebc should knock this one out. All joins will require "on " except comma-joins like select * from a, b, c where ....