[BUG]: PostgreSQL ORDER BY and NULLS FIRST, NULLS LAST
Describe the bug I'm not sure if it's bug or feature request but I'm leaning more towards bug, so I'm marking it as a bug.
In PostgreSQL you can decide how to treat NULLS when ordering records: NULLS FIRST, NULLS LAST.
Examples:
SELECT a.* FROM my_table a ORDER BY a.total_sum DESC NULLS LAST; SELECT * FROM current_store ORDER BY qty ASC NULLS FIRST;
PostgreSQL documentation:
https://www.postgresql.org/docs/current/queries-order.html
When trying to use it with Phalcon ORM (PostgreSQL dialect), it produces error:
Syntax error, unexpected token IDENTIFIER(NULLS), near to ' LAST LIMIT :APL0: OFFSET :APL1:'
To Reproduce Just use Phalcon ORM builder and try to order by [ASC|DESC] [NULLS LAST|NULLS FIRST]
$builder->orderBy('DESC NULLS LAST);
$builder->orderBy('DESC NULLS FIRST);
$builder->orderBy('ASC NULLS LAST);
$builder->orderBy('ASC NULLS FIRST);
Right now pgsql part of phalcon orm quite poor and not all features implemented. But. It has Criteria feature, which can be used to implement custom expressions.
Yes, and I've previously contributed to Phalcon ORM and fixed minor issue regarding PostgreSQL, maybe I will fix it too, but I'm not too good with all the building process and github at all, but if it not gonna be fixed in like 2-3 months I probably will try.
RN we team is out of resourses for extending orm and implementing new features due to finishing v5 asap. It will be gr8, if you create non-bc pull request with such a fix.
When I'll find the Time I will try, right now I fixed my problem by other way around.