feathersjs-ecosystem / feathers-objection

Feathers database adapter for Objection.js, an ORM based on KnexJS SQL query builder for Postgres, Redshift, MSSQL, MySQL, MariaDB, SQLite3, and Oracle. Forked from feathers-knex.
MIT License
98 stars 48 forks source link

REST query for a service with composite key returns an error in postman Incorrect syntax near ',' #178

Open haniyasin opened 2 years ago

haniyasin commented 2 years ago

Summary : auto generated query to count is not compatible with MSSQL it should be something like : select count (*) from ( select distinct CompanyID, DivisionID,DepartmentID,OrderNumber from orderheader )AS sub


Postman request URL: http://localhost:3030/orderheader?companyid=Dinos&divisionid=default&departmentid=default

error result(postman): "name": "GeneralError", "message": "select count(distinct [orderheader].[CompanyID], [orderheader].[DivisionID], [orderheader].[DepartmentID], [orderheader].[OrderNumber]) as [total] from [orderheader] where [companyid] = @p0 and [divisionid] = @p1 and [departmentid] = @p2 - Incorrect syntax near ','.", "code": 500, "className": "general-error", "errors": {} }

service options: const options = { Model: createModel(app), paginate: app.get('paginate'), id:['CompanyID','DivisionID','DepartmentID','OrderNumber'] };

Connection : const client = 'mssql' const connection = { user: 'enterprise', password: 'enterprise', server: 'localhost', database: 'enterprise', port: 1433, //debug: true, options: { encrypt: false } }

Dependencies: "dependencies": { "@feathersjs/authentication": "^4.5.14", "@feathersjs/authentication-local": "^4.5.14", "@feathersjs/authentication-oauth": "^4.5.14", "@feathersjs/configuration": "^4.5.12", "@feathersjs/errors": "^4.5.12", "@feathersjs/express": "^4.5.14", "@feathersjs/feathers": "^4.5.12", "@feathersjs/socketio": "^4.5.14", "@feathersjs/transport-commons": "^5.0.0-pre.20", "compression": "^1.7.4", "cors": "^2.8.5", "feathers-objection": "^7.5.3", "helmet": "^4.6.0", "knex": "^2.0.0", "mssql": "^8.1.0", "objection": "^3.0.1", "serve-favicon": "^2.5.0", "winston": "^3.7.2" },