-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Query with NOW() - INTERVAL '? seconds' error: expected 0 arguments #3631
Comments
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the |
you might using an old pgx driver, upgrade it should fix the issue. |
Oh wow. I think everything is already updated. my go.mod is:require (
github.com/go-chi/chi v4.1.2+incompatible
github.com/golang/protobuf v1.4.3 // indirect
github.com/gorilla/sessions v1.2.1
github.com/joho/godotenv v1.3.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/rs/cors v1.7.0
github.com/rs/zerolog v1.20.0
github.com/stretchr/testify v1.6.1 // indirect
github.com/volatiletech/authboss-clientstate v0.0.0-20200826024349-8d4e74078241
github.com/volatiletech/authboss/v3 v3.0.2
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect
golang.org/x/net v0.0.0-20201020065357-d65d470038a5 // indirect
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gorm.io/driver/postgres v1.0.2
gorm.io/gorm v1.20.2
syreclabs.com/go/faker v1.2.2
) my go.sum is:
What I need to do to fix my query? Maybe this is something wrong with Gorm because of the apostrophes that contain the question mark?
in the query: db.Where("created_at < NOW() - INTERVAL '? hours' OR updated_at < NOW() - INTERVAL '? seconds'", hours, seconds).Delete(&tweet) Could this be the problem? |
Having arguments in a string Changing the example from above: db.Where("created_at < NOW() - make_interval(hours => ?) OR updated_at < NOW() - INTERVAL '? seconds'", hours, seconds).Delete(&tweet) |
GORM Playground Link
go-gorm/playground#1
Description
I'm using this:
The query created is:
The error is:
Why?
What I have to use instead?
The text was updated successfully, but these errors were encountered: