Opened 6 months ago
Closed 6 weeks ago
#35839 closed Bug (fixed)
GeneratedField with db_comment causes syntax error
Reported by: | Jason Christa | Owned by: | JaeHyuckSa |
---|---|---|---|
Component: | Migrations | Version: | 5.0 |
Severity: | Normal | Keywords: | |
Cc: | Jason Christa, Mariusz Felisiak | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | |||
Description ¶
Adding a new GeneratedField with the db_comment argument cause invalid SQL to be generated for MySQL (maybe others but that is all I tested). Altering a GeneratedField with a db_comment seems to work fine.
Change History (10)
comment:1 by , 6 months ago
Component: | Database layer (models, ORM) → Migrations |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 6 months ago
Jason, If you're interested in submitting a patch it seems that the solution lies in changing the order of the generated SQL in _iter_column_sql
.
comment:3 by , 6 months ago
Cc: | added |
---|
follow-up: 5 comment:4 by , 6 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
I'd like to try resolving this ticket!
follow-up: 6 comment:5 by , 5 months ago
Replying to JasonCalm:
I'd like to try resolving this ticket!
Jason, are you working on this? If not, I'd be happy to pass this to my Djangonauts.
comment:6 by , 5 months ago
Replying to Mariusz Felisiak:
Replying to JasonCalm:
I'd like to try resolving this ticket!
Jason, are you working on this? If not, I'd be happy to pass this to my Djangonauts.
Yes, I'm currently working on this part!
comment:7 by , 6 weeks ago
Owner: | changed from | to
---|
comment:8 by , 6 weeks ago
Has patch: | set |
---|
comment:9 by , 6 weeks ago
Triage Stage: | Accepted → Ready for checkin |
---|
Reproduced with the following test
TabularUnified tests/schema/tests.py
It appears that the problem is due to the order the the
COMMENT
andGENERATED
clause in the generated SQL.MySQL expects
COMMENT
to come afterGENERATED
while we do the oppositeCrashes while
passes.