Querying with two consecutive WITH causes error "the table is not part of the query"

I created my query by stages. I create a part, check it's result via await and .all() then I turn it to CTE ($with) and use in from() of the next stage. The first part (screenshot 1) 1. Worked well via direct await 2. Worked well when turned into $with and used in .from() of next stage The second part (screenshot 2) 1. Worked well via direct await 2. Stops working when I use it in .from() of the next stage (screenshot 3), outputs an error:
Error: Your "sectionsTags->section_id" field references a column "section_tag"."section_id", but the table "section_tag" is not part of the query! Did you forget to join it?
at SQLiteAsyncDialect.buildSelectQuery
Error: Your "sectionsTags->section_id" field references a column "section_tag"."section_id", but the table "section_tag" is not part of the query! Did you forget to join it?
at SQLiteAsyncDialect.buildSelectQuery
In 3rd stage you see me trying to fix it by manually adding fields to select after seeing such tip here in discord under question with similar error. I think error is not in second or first screenshot since everything works fine until I turn second stage to CTE too and try to use in in next stage. Dialect is SQLite (libSQL). @bloberenober Can this be a bug in QB in code that is detecting for this error?
No description
No description
No description
1 Reply
Andrii Sherman
Andrii Sherman16mo ago
bumping for @bloberenober to answer
Want results from more Discord servers?
Add your server