-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating entity with sea-orm-cli panics when foreign key was added on table on postgres #116
Comments
May relavant: #28 Here's the query result of SELECT
"table_constraints"."constraint_schema",
"table_constraints"."constraint_name",
"table_constraints"."table_schema",
"table_constraints"."table_name",
"table_constraints"."constraint_type",
"table_constraints"."is_deferrable",
"table_constraints"."initially_deferred",
"check_constraints"."check_clause",
"key_column_usage"."column_name",
"key_column_usage"."ordinal_position",
"key_column_usage"."position_in_unique_constraint",
"referential_constraints_subquery"."unique_constraint_schema",
"referential_constraints_subquery"."unique_constraint_name",
"referential_constraints_subquery"."match_option",
"referential_constraints_subquery"."update_rule",
"referential_constraints_subquery"."delete_rule",
"referential_constraints_subquery"."table_name",
"referential_constraints_subquery"."column_name"
FROM
"information_schema"."table_constraints"
LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name"
AND "table_constraints"."constraint_catalog" = "check_constraints"."constraint_catalog"
AND "table_constraints"."constraint_schema" = "check_constraints"."constraint_schema"
LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name"
AND "table_constraints"."constraint_catalog" = "key_column_usage"."constraint_catalog"
AND "table_constraints"."constraint_schema" = "key_column_usage"."constraint_schema"
AND "table_constraints"."table_catalog" = "key_column_usage"."table_catalog"
AND "table_constraints"."table_schema" = "key_column_usage"."table_schema"
AND "table_constraints"."table_name" = "key_column_usage"."table_name"
LEFT JOIN (
SELECT
DISTINCT "referential_constraints"."constraint_name",
"referential_constraints"."unique_constraint_schema",
"referential_constraints"."unique_constraint_name",
"referential_constraints"."match_option",
"referential_constraints"."update_rule",
"referential_constraints"."delete_rule",
"constraint_column_usage"."table_name",
"constraint_column_usage"."column_name"
FROM
"information_schema"."referential_constraints"
LEFT JOIN "information_schema"."constraint_column_usage" ON "referential_constraints"."constraint_name" = "constraint_column_usage"."constraint_name"
) AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name"
WHERE
"table_constraints"."table_schema" = 'public'
AND "table_constraints"."table_name" = 'chat_channel_user'
AND "referential_constraints_subquery"."table_name" NOT IN (
SELECT
"pg_class"."relname"
FROM
"pg_inherits"
JOIN "pg_class" ON "pg_inherits"."inhrelid" = "pg_class"."oid"
AND "pg_class"."relkind" IN ('r', 't', 'v', 'm', 'f', 'p')
)
ORDER BY
"table_constraints"."constraint_name" ASC,
"key_column_usage"."ordinal_position" ASC,
"referential_constraints_subquery"."unique_constraint_name" ASC,
"referential_constraints_subquery"."constraint_name" ASC
However, the values are different than expected.
|
I've found that the user that connected does not have permission for something. I got fixed by adding permission to the user. |
This seems to be a very rare situation, the column shouldn't return null. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Generating entity with
sea-orm-cli
panics when the foreign key is added to the table on postgres.Steps to Reproduce
sea-orm-cli generate entity
Expected Behavior
Should not crash and generate a schema.
Actual Behavior
It panics. I've checked with (tables without foreign keys) and it ran successfully.
Reproduces How Often
I'm guessing that this problem happens every time when foreign key is added.
Versions
sea-orm-cli
: 0.12.3Additional Information
The code where it crashes:
sea-schema/src/postgres/parser/table_constraints.rs
Line 52 in bdc6f5e
The logs that ran
sea-orm-cli generate entity --verbose
: log.txtThe text was updated successfully, but these errors were encountered: