You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be an issue with the preloading that has been introduced since rel 0.39.0. The issue causes the nested relations of a preload to be accidentally duplicated.
I discovered this when trying to upgrade from go v1.18 to v.22 which meant that I needed the latest REL to be compatible.
I have tried to investigate but it's not clear to me how to fix the problem.
Versions:
go v1.22.0
rel v0.41.0
Here's a quick repro:
BEGIN;
CREATETABLEquestions (
id SERIALPRIMARY KEY,
textTEXT
);
CREATETABLEanswers (
id SERIALPRIMARY KEY,
question_id INTEGERREFERENCES questions(id)
);
CREATETABLEscheduled_questions (
id SERIALPRIMARY KEY,
question_id INTEGERREFERENCES questions(id)
);
INSERT INTO questions (text) VALUES ('1');
INSERT INTO answers (question_id) VALUES (1);
INSERT INTO scheduled_questions (question_id) VALUES (1);
INSERT INTO scheduled_questions (question_id) VALUES (1);
COMMIT;
I'm able to fix this in this PR: #365
can you verify if it's fixed your issue?
I think the main issue is because pointer is used when the same record is referenced multiple time
without above fix, the following should work correctly:
type ScheduledQuestion struct {
ID int
QuestionID int
Question Question // <--- not using pointer here
}
Hi, firstly thanks for this awesome library.
There seems to be an issue with the preloading that has been introduced since rel 0.39.0. The issue causes the nested relations of a preload to be accidentally duplicated.
I discovered this when trying to upgrade from go v1.18 to v.22 which meant that I needed the latest REL to be compatible.
I have tried to investigate but it's not clear to me how to fix the problem.
Versions:
Here's a quick repro:
output:
This result should be:
The text was updated successfully, but these errors were encountered: