I have an Objection QueryBuilder that produces the following SQL:
SELECT
my_table.*
FROM
my_table
INNER JOIN other_table1 ON 1=1
INNER JOIN other_table2 ON 1=1
WHERE
other_table2.thing = ?
cursorPagination produces this SQL which results in Postgres returning the error missing FROM-clause entry for table "my_table"
SELECT
*
FROM
(
SELECT
my_table.*,
FROM
my_table
INNER JOIN other_table1 ON 1=1
INNER JOIN other_table2 ON 1=1
WHERE
other_table2.thing = ?
ORDER BY
"id" DESC,
"id" DESC
LIMIT $2
) AS "last_subquery"
INNER JOIN other_table1 ON 1=1
INNER JOIN other_table2 ON 1=1
ORDER BY
"id" ASC,
"id" ASC
Offending line
I have an Objection QueryBuilder that produces the following SQL:
cursorPagination produces this SQL which results in Postgres returning the error
missing FROM-clause entry for table "my_table"