Incorrect escaping for order keyword in Oracle

Open
#595 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
fsharp, sql
Domain
databases

Research direction

Start by reproducing the F# SQLProvider query shown in the issue against Oracle 11 XE and inspect the generated SQL, focusing on the order alias in the JOIN. Done means the same query executes successfully when the alias is an Oracle keyword, with the generated SQL using valid escaping.

Written by the indexing model from the issue text.

Description

Oracle
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
  • Oracle 11 XE
  • Windows
  • Latest version of SqlProvider
  • .net core 2.2
Dominant language
F#
Stars
627
Forks
147
Avg merge
2h 2m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fsprojects/SQLProvider

All issues in fsprojects/SQLProvider

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.