HTTP Error 50X when using PostgreSQL

Viewed 19

I have built Apache Answer from the source code (commit 209cf70) and just switched the database from SQLite to PostgreSQL. After this switch, when opening a question, I can briefly see it, then I get this error:
HTTP Error 50X
The server encountered an error and could not complete your request.

The console shows:

2025-12-07 12:12:27.341 ERROR   handler/handler.go:53   code: 500, reason: base.database_error, message: , error: pq: invalid input syntax for type bigint: "null"
/home/arnaud/answer/internal/repo/comment/comment_repo.go:112 github.com/apache/answer/internal/repo/comment.(*commentRepo).GetComment
/home/arnaud/answer/internal/service/comment/comment_service.go:399 github.com/apache/answer/internal/service/comment.(*CommentService).GetCommentWithPage
/home/arnaud/answer/internal/controller/comment_controller.go:261 github.com/apache/answer/internal/controller.(*CommentController).GetCommentWithPage
/home/arnaud/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 github.com/gin-gonic/gin.(*Context).Next
/home/arnaud/answer/internal/base/middleware/auth.go:88 github.com/apache/answer/internal/base/server.NewHTTPServer.(*AuthUserMiddleware).EjectUserBySiteInfo.func9
/home/arnaud/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 github.com/gin-gonic/gin.(*Context).Next
/home/arnaud/answer/internal/base/middleware/auth.go:75 github.com/apache/answer/internal/base/server.NewHTTPServer.(*AuthUserMiddleware).Auth.func8
/home/arnaud/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 github.com/gin-gonic/gin.(*Context).Next
/home/arnaud/go/pkg/mod/github.com/anargu/[email protected]/gin_brotli.go:71 github.com/apache/answer/internal/base/server.NewHTTPServer.Brotli.func3
/home/arnaud/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 github.com/gin-gonic/gin.(*Context).Next
/home/arnaud/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:633 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
/home/arnaud/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:589 github.com/gin-gonic/gin.(*Engine).ServeHTTP
/home/arnaud/go/pkg/mod/golang.org/[email protected]/src/net/http/server.go:3210 net/http.serverHandler.ServeHTTP
/home/arnaud/go/pkg/mod/golang.org/[email protected]/src/net/http/server.go:2092 net/http.(*conn).serve
/home/arnaud/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1700 runtime.goexit

Any idea how to solve this problem?

1 Answers