objection.js
objection.js copied to clipboard
It is possible to add the postgres ONLY keyword to a query? (Question)
Is there a way to add the ONLY keyword to a postgres query? I'm able to do it without a Model and using knex with .from(knex.raw(ONLY parent)) directly but I was wondering if it were possible to modify a query to add ONLY. For example, I'm trying to perform a query involving inherited tables like so.
SELECT * FROM ONLY parent NATURAL FULL JOIN child;
with .joinRaw, I can add the NATURAL FULL JOIN.
I tried messing around with modifiers but couldn't seem to get it to work.
Knex supports this as an option on knex() also: https://knexjs.org/guide/query-builder.html#knex
Do you have a suggestion how this could be added to Objection models?