Join GitHub today
please hint about missing "as()" when from(subquery) is missing it #3485
Knex version: 0.19.5
Feature discussion / request
I find myself often spending hours trying to figure how to make
However knex outputs a wrong sql statement (missing parenthesis) and when debugging, it looks like a bug in knex.
I think it would be nice to users if a missing as() could be detected and a warning printed.
Generally knex cannot know if parenthesis are required or not, but in this particular case I believe that knex knows enough about query semantics to be able to add them (and to avoid adding them twice).
I would be happy to accept PR for implementing this (with integration test for all the dialects and also with case where .as is used that it doesn't create double parenthesis).