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

Can a select statement be constructed using "raw"? #192

Open sokulski opened 1 year ago

sokulski commented 1 year ago

I have the following line in a request on a system that has been out of use for about 14 months. In the ensuing time MariaDB was updated and tests were performed, but this system was not tested as it was not operational at the time.

The offending line is in the request is:

$select: [this.raw('*, (capacity_remaining / capacity) as "capacity_remaining_percentage"')],

The query is failing because the select query cannot be parsed by _selectQuery. The error is item.match is not a function which points me towards the item not being a string as expected.

Is there another means of constructing a raw select statement for a query in Feathers Objection?