Hi I have the following data query:
{:select [:*],
:from [:definition],
:full-join [:note [:= :note/definition-id :definition/definition-id]],
:join
[[:author :note-author] [:= :note/author-id :note-author/author-id]]}
and its producing the following sql:
SELECT *
FROM definition
INNER JOIN author AS note_author ON note.author_id = note_author.author_id
FULL JOIN note ON note.definition_id = definition.definition_id
What should I do to make the inner join appear after the full join?Ow wow I just read about :join-by in the docs
{:select [:*],
:from [:definition],
:join-by
[:full
[:note [:= :note/definition-id :definition/definition-id]]
:join
[[:author :note-author] [:= :note/author-id :note-author/author-id]]]}
This solves my problemYup, not all databases care about join order but some do -- so :join-by was added for those "sensitive" databases 🙂
(I mean, SQL is relational so order absolutely should not matter)
Yeah looks like postres is a bit more sensitive 😆
https://github.com/seancorfield/honeysql/issues/277 was the issue.
Thanks a lot for all your work on this, this is a incredible library together next-jdbc it's super powerfull