adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.08k stars 195 forks source link

Invalid object name in MSSQL #974

Closed jbrhinalyn closed 11 months ago

jbrhinalyn commented 12 months ago

Prerequisites

I have this script in my Controller let availabilities = await Availability.query().select("id","available").orderBy("available","asc")

When I open in the browser, it gives me this error: {"message":"select [id], [available] from [availabilities] order by [available] asc - Invalid object name 'availabilities'."}

But when I run this SQL to sqlcmd select [id], [available] from [availabilities] order by [available] asc - Invalid object name 'availabilities'. It works.

What could the cause of this? Any help highly appreciated.

thetutlage commented 11 months ago

Sorry, we do not have enough information to know why the query works with the CLI and not with Lucid. There are too many knowns for us. Are you running queries against the same DB, same version?

You need to debug it further yourself and report an issue, if you need Lucid to be generating incorrect queries