-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with knex using postgres driver #20
Comments
@jtiala I've submitted a few PRs that might fix the issues you mentioned above since these issues were first created. Do you have time to try the latest version of the library and see if that fixes your problems? |
Thanks! I'll try to find some time on the weekend to test this out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I encountered some problems while trying to use this library with apollo-server setup using PostgreSQL as database and knex. My setup doesn't use objection ORM, it just calls knex queries straight from the resolver.
I forked the library and added posgres driver to isolate the issue from my setup. I created a new table,
cities
, since my initial problem was concerning a calculated column, which shows distance between coordinates in the database compared to coordinates in the query.Most of the added code is here. The file contains detailed comments on the problem. I also added notes to the readme on how to run dockerized posgres to test this on. By the way, this can not be tested on sqlite since it doesn't have the necessary math functions to calculate distances.
I encountered two problems.
.groupBy('id')
is needed when selecting the columns using.select()
. Even though the exact same query is generated with.select(['*'])
and omitting the select altogether. When driving the sqlite driver, this problem doesn't occur. Seeimplementation2
in the file linked before.first
pagination parameter. The column appears in the results and results can be sorted based on the calculated column. Using anything else thanfirst
breaks the query. Seeimplementation3
.Any idea what might be causing this?
If you would like to include the test cases in the repo, I can clean them up and do a PR. There are no tests tho, didn't have time to setup postgres tests. I also added some general notes on the readme, feel free to copy them if you feel so :)
The text was updated successfully, but these errors were encountered: