Add SqlListLazy to OrmLite
When using raw SQL, due to having complex CTE queries, that does not start with SELECT
but rather with WITH
, the SqlList
method loads everything in one go.
This is unfortunate when the result set is large, and we would like to process one row at a time, and avoid the memory overhead, and waiting time, of getting the whole result set at once.
The SelectLazy
would have solved this problem, if it had supported any arbitrary SQL, but it does not.
According to the documentation SelectLazy
can do this if the SQL starts with SELECT
however, for our case the query is a CTE, so it starts with WITH
.
Having a SqlListLazy
that allows us to run complex CTE queries efficiently would solve this.
Alternatively, change SelectLazy
to recognise CTE queries that start with WITH
For documentation on the WITH syntax in PostgreSQL see https://www.postgresql.org/docs/11/queries-with.html

This should now be supported using the existing `SelectLazy` APIs from v5.7.1+ that’s now available on MyGet.