If you use
sqlite3 driver in your Golang project, you may encounter the following error when you try to insert a new record to the table.
insert nodes to table "users": near "RETURNING": syntax error
The error message indicates that the
sqlite3 driver does not support the
If you are using Golang sqlite3 package
github.com/mattn/go-sqlite3 in your project. The issue may be caused by the version of the package.
go.mod file, check the version of the package. If it is
v2.0+, you are likely to encounter the same problem.
4 entgo.io/ent v0.12.3
5 github.com/mattn/go-sqlite3 v2.0.1+incompatible
If your package version is also
v2.0+, you may encounter the same issue.
To resolve the issue, downgrade the
go-sqlite3 package to
v1.14+. For example, use version
v1.14.11 in your project. Execute the following command in the directory containing your
go get email@example.com
Don’t worry about using an older version, as the latest stable version released by the author is
v1.14.16 as of October 2022. Therefore, it is safe to use version
v1.14.11 or later.
If this post helped you to solve a problem or provided you with new insights, please upvote it and share your experience in the comments below. Your comments can help others who may be facing similar challenges. Thank you!