fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
572 stars 146 forks source link

Incorrect escaping for order keyword in Oracle #595

Open OnurGumus opened 5 years ago

OnurGumus commented 5 years ago

Description

I have the following query for oracle :

let qry =
        query {
            for cust in ctx.Onur.Customers do
            join order in (!!) ctx.Onur.Customers on (cust.CustomerId = order.CustomerId)
            select (cust.CustomerId)

        } |> Seq.toArray |> printf "%A"

This generates the following SQL :

SELECT cust.CUSTOMER_ID as "cust.CUSTOMER_ID" FROM ONUR.CUSTOMERS cust LEFT OUTER JOIN  ONUR.CUSTOMERS order on cust.CUSTOMER_ID = order.CUSTOMER_ID "

The problem is here "ONUR.CUSTOMERS order" since order is also a keyword for Oracle the query fails with a missing keyword error. If you use any other name than order the query works. So there should be a way to escape order

Related information