Postgres function inspector reads wrong column ordinals: any schema with a function fails integrity inspection
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 92/100
Hướng nghiên cứu
Bắt đầu với truy vấn danh mục functions và trình đọc trong Migration/Nimblesite.DataProvider.Migration.Postgres/PostgresSupportSchemaInspector.cs, so sánh các cột được chọn với các thứ tự được GetString, IsDBNull và GetBoolean sử dụng. Chạy DataProviderMigrate migrate --provider postgres với schema được cung cấp có chứa functions: để tái hiện lỗi tính toàn vẹn. Hoàn tất khi hàm được kiểm tra với đúng chủ sở hữu, đường dẫn tìm kiếm và các cờ thu hồi, quá trình di chuyển vượt qua kiểm tra tính toàn vẹn và việc chạy lại không làm thay đổi gì.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug
At refactor/deslop-ten-percent (3b4e356522affc61b466d8e87ef5232319c9d7a0), DataProviderMigrate migrate --provider postgres fails for every schema that has a function in the inspected schema (for example a top-level functions: entry):
Error: schema integrity inspection failed: Reading as 'System.String' is not supported for fields having DataTypeName 'boolean'
Error: migration apply failed: Schema integrity verification failed before commit
Cause
Migration/Nimblesite.DataProvider.Migration.Postgres/PostgresSupportSchemaInspector.cs: the functions catalog query selects, in order,
| ordinal | column |
|---|---|
| 7 | p.prosecdef |
| 8 | p.prosrc |
| 9 | owner.rolname AS owner_role |
| 10 | search_path_config |
| 11 | revoke_public_execute (boolean) |
| 12 | execute_roles |
but the reader uses
OwnerRole = reader.GetString(10),
SearchPath = ParseSearchPathConfig(reader.IsDBNull(11) ? null : reader.GetString(11)),
RevokePublicExecute = reader.GetBoolean(9),
so it reads a boolean as a string (and the owner as a boolean).
Fix
OwnerRole = reader.GetString(9),
SearchPath = ParseSearchPathConfig(reader.IsDBNull(10) ? null : reader.GetString(10)),
RevokePublicExecute = reader.GetBoolean(11),
Verified on PostgreSQL with a securityDefiner function declaring ownerRole, searchPath, executeRoles and revokePublicExecute: with the three ordinals corrected, migrate applies, passes the integrity check and replays as a no-op.
Repro
roles:
- { name: demo_writer, login: false }
functions:
- schema: demo
name: touch
returns: void
language: sql
volatility: volatile
securityDefiner: true
ownerRole: demo_writer
searchPath: [pg_catalog]
body: SELECT 1
Related gaps found at the same time
- Grants have no column lists (
GRANT SELECT (a, b) ON TABLE …); only table-level privileges can be declared, inspected and verified. - Roles have no way to receive a password (for example from an environment variable).
- A schema cannot be created by the migration (
CREATE SCHEMAmust be run by hand first).
- Ngôn ngữ chính
- C#
- Star
- 68
- Fork
- 4
- Merge trung bình
- 50 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- 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 Nimblesite/DataProvider
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Nimblesite/DataProvider#72 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Nimblesite/DataProvider#121 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Nimblesite/DataProvider#108 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A check constraint the schema cannot name can never be retired, and keeps enforcing the old ruleĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Nimblesite/DataProvider#107 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Nimblesite/DataProvider#106 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Nimblesite/DataProvider
Issue tương tự
-
kronos:develop:queued priority:P0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
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 65/100
nopSolutions/nopCommerce#8512 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
modelcontextprotocol/csharp-sdk#2061 ·
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 76/100
Maintainer thường phản hồi trong vòng 1 ngày