davispuh commented on issue #1277: URL: https://github.com/apache/answer/issues/1277#issuecomment-2722195959
Did you look at logs? It looks like visually everything appears to be working but whenever question is asked then I see this error in logs. Maybe because I'm using PostgreSQL makes difference? Also question title/content doesn't matter. All I did was download 1.4.2 release https://github.com/apache/answer/releases/download/v1.4.2/apache-answer-1.4.2-bin-linux-amd64.tar.gz do `answer init` (setup using PostgreSQL) and then `answer run`. Then go in SEO settings and change to short ID. Then ask question with any tittle and any content for example just `123456`. And in logs I see ``` ERROR question_common/question.go:712 get linked question ids error code: 500, reason: base.database_error, message: , error: pq: invalid input syntax for type bigint: "D1Z1" ``` It's obvious that it's bug because you can't store string like `D1Z1` as bigint number. And you can see that in https://github.com/apache/answer/blob/v1.4.2/internal/entity/question_link_entity.go#L35 how they are defined as `bigint` type. It looks like here https://github.com/apache/answer/blob/v1.4.2/internal/service/question_common/question.go#L710 when we invoke `GetLinkedQuestionIDs()` we do it directly with `questionID` while above we use `uid.DeShortID` but not here. we can see it's directly passed to SQL https://github.com/apache/answer/blob/v1.4.2/internal/repo/question/question_repo.go#L734 Interestingly somehow it still got stored and seems to be working...  ``` $ pg_dump answer --table question_link CREATE TABLE public.question_link ( id bigint NOT NULL, created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at timestamp without time zone, from_question_id bigint DEFAULT 0 NOT NULL, from_answer_id bigint, to_question_id bigint DEFAULT 0 NOT NULL, to_answer_id bigint, status integer DEFAULT 1 NOT NULL ); COPY public.question_link (id, created_at, updated_at, from_question_id, from_answer_id, to_question_id, to_answer_id, status) FROM stdin; 1 2025-03-13 17:19:09 2025-03-13 17:19:09 10010000000000022 0 10010000000000020 0 1 2 2025-03-13 17:34:22 2025-03-13 17:34:22 10010000000000025 0 10010000000000023 0 1 ``` Anyway I think this should fix it ```diff - linkedQuestionIDs, err := qs.questionRepo.GetLinkedQuestionIDs(ctx, questionID, entity.QuestionLinkStatusDeleted) + linkedQuestionIDs, err := qs.questionRepo.GetLinkedQuestionIDs(ctx, uid.DeShortID(questionID), entity.QuestionLinkStatusDeleted) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
