kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
9.82k stars 250 forks source link

Incorrect syntax near 'format' #1013

Closed mjbergman92 closed 1 month ago

mjbergman92 commented 1 month ago

See Playground

This works in playground and I am able to execute the query in SSMS; however, in code, I am getting this error while the query is being built:

[
  RequestError: Incorrect syntax near 'format'.
      at RequestTokenHandler.onErrorMessage (/home/mbergman/repos/appsmith-koa/node_modules/tedious/src/token/handler.ts:391:21)
      at Readable.<anonymous> (/home/mbergman/repos/appsmith-koa/node_modules/tedious/src/token/token-stream-parser.ts:22:55)
      at Readable.emit (node:events:517:28)
      at addChunk (node:internal/streams/readable:368:12)
      at readableAddChunk (node:internal/streams/readable:341:9)
      at Readable.push (node:internal/streams/readable:278:10)
      at next (node:internal/streams/from:98:31)
      at processTicksAndRejections (node:internal/process/task_queues:95:5) {
    code: 'EREQUEST',
    number: 102,
    state: 1,
    class: 15,
    serverName: 'DR-NAV',
    procName: '',
    lineNumber: 1
  },
]

I am unsure what format error this is referring to. I assume this has to do with how the tedious driver is used in kysely, that's why I'm submitting this here and not tedious.

mjbergman92 commented 1 month ago

The error was caused by trying to call explain('json') for some reason, but it's not a concern for me. I am closing the issue.