Closed taobojlen closed 1 year ago
The problem is probably that the order
field name isn't quoted correctly. Since order
is a SQL keyword the SQL should use a quoted variant ("order"
) instead. Respectively we should just always apply quoting to the field name.
Do you want to attempt to fix this?
(A workaround would be to use a different name for the field, for example ordering
or position
or something.)
Thanks @matthiask ! Yes, I'll give it a go.
I'm trying to use django-tree-queries in combination with django-ordered-model. That library provides some useful helper methods for ordering, like methods to move a record to a different place in the ordering, or to swap two records. I don't think that there's any reason these two libraries should be incompatible.
The issue I'm running into is that django-tree-queries is generating invalid SQL. My model looks something like this:
When I try to execute queries I get a SQL syntax error. The generated SQL looks like, for example
The problem is with
array[order] AS tree_ordering
. Postgres throws a syntax error on this part.Am I doing anything obviously wrong here?