[@loopback/sequelize] Duplicate column names in relation queries
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
Bắt đầu với các bài kiểm thử extension của Sequelize và các thay đổi để tái hiện trong commit 3c29d852b46f19f4805d556ae32aee49c79471f1. Kiểm tra thiết lập quan hệ Patient và cách xử lý keyFrom, keyTo và through trước khi truy vấn đến Sequelize. Hoàn thành khi các quan hệ không có mọi thuộc tính được thiết lập rõ ràng không còn tạo ra các cột trùng lặp, với kiểm thử hồi quy trong các bài kiểm thử extension.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Repository queries with relations that do not explicitly set all the keyTo / keyFrom / through properties will lead to broken SQL queries that contain duplicated title case column names mixed in with the expected camelcase columns.
Example:
SELECT bookid as bookId, reader.id as readerId, ReaderId …
Relates to:
https://github.com/sequelize/sequelize/issues/9328
https://github.com/loopbackio/loopback-next/issues/9591
https://github.com/sourcefuse/loopback4-sequelize/issues/35
Logs
No response
Additional information
Workaround seems to be to go through all the Entity relations and explicitly set all the relation key names but that can be time-consuming and error-prone with a larger project. It seems like it might be possible to mitigate this at the loopback model to Sequelize relation layer.
Reproduction
With these changes, running the tests for the Sequelize extension will replicate the error:
https://github.com/KalleV/loopback-next/commit/3c29d852b46f19f4805d556ae32aee49c79471f1
Turns out it's necessary to define additional "belongsTo" relations in other entities before this happens. The extra relation is added to the "Patient" entity in this case. With this set up, I am seeing the following happen:
- The default relation properties are set by Loopback (i.e. I can see the "keyFrom" is populated as todoListId) but the "keyTo" is undefined:
- This leads to undefined being passed as the foreign key to sequelize:
- And then that causes Sequelize to assign a Title Case property through it's own default relation column logic leading to a duplicate column name in the database query:
- Ngôn ngữ chính
- TypeScript
- Star
- 5.1k
- Fork
- 1.1k
- Merge trung bình
- 5 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của loopbackio/loopback-next
-
Docs good first issue help wanted
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
loopbackio/loopback-next#683 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
loopbackio/loopback-next#11726 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
loopbackio/loopback-next#11500 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 4 ngày
-
@param.array throws INVALID_PARAMETER_VALUE:must be string if more than 20 elements are sentĐang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
loopbackio/loopback-next#11412 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Query parameter array parsing broken for >20 items after qs upgrade (CVE fix side effect)Có thể làm lại được @KauanAfonso đã nhận 122 ngày trước và không có pull request nào đang mở. Đang mởbug help wanted
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
loopbackio/loopback-next#11396 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của loopbackio/loopback-next
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NousResearch/hermes-agent#136483 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Tool errors containing cycles or BigInt crash getErrorMessage and replace the original failureĐang mởfactory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
vercel/ai#22796 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Web chat input doesn't regain focus after a reply finishesCó thể đã có người làm @GaijinSystems đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
zeroclaw-labs/zeroclaw#11658 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
babylonlabs-io/babylon-toolkit#2711 ·
Maintainer thường phản hồi trong vòng 1 ngày