Skip to content
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

Prepared(true) does not work with postgres #427

Open
1 of 3 tasks
veqryn opened this issue Sep 2, 2024 · 5 comments
Open
1 of 3 tasks

Prepared(true) does not work with postgres #427

veqryn opened this issue Sep 2, 2024 · 5 comments

Comments

@veqryn
Copy link

veqryn commented Sep 2, 2024

Describe the bug
When using .Prepared(true) it replaces the interpolated arguments with ?, even though Postgres is expecting $1, $2, etc.

Expected behavior
I expect it to use the correct parameter format.

Dialect:

  • postgres
  • mysql
  • sqlite3

Additional context

  1. Why is interpolation the default?
  2. Why did goqu go to all the trouble to write an interpolation layer, when every database takes parameters? It seems much much safer to let Postgres do the interpolation, rather than just a library to do it.
@OriBenZaken
Copy link

We also encountered this issue on our team.
This fix is very much needed, please.

@filipencopav
Copy link

Try adding

import _ "github.com/doug-martin/goqu/v9/dialect/postgres"

At the top of your file and see if it creates $1, $2, $3 etc.

@nickzelei
Copy link

Echoing filipencopav, this is generally an issue when you haven't imported the postgres dialect. Goqu falls back to the ? arguments when it does not detect an imported driver.

@veqryn
Copy link
Author

veqryn commented Nov 15, 2024

Why is interpolation the default?
Why did goqu go to all the trouble to write an interpolation layer, when every database takes parameters? It seems much much safer to let Postgres do the interpolation, rather than having a 3rd party library to do it.

@denizgursoy
Copy link

I had the same @filipencopav solution worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants