Opened 10 years ago
Closed 10 years ago
#25257 closed New feature (duplicate)
Changing CharField to GenericIPAddressField with PostgreSQL should use "using field::inet"
| Reported by: | no | Owned by: | nobody |
|---|---|---|---|
| Component: | Migrations | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The sql issued to postgresql when converting a CharField to a GenericIpAddress should be along the line of
ALTER TABLE table ALTER COLUMN ip_field TYPE inet USING ip_field::inet;
Instead I get an error:
django.db.utils.ProgrammingError: column "ip" cannot be cast automatically to type inet
HINT: Specify a USING expression to perform the conversion.
Change History (4)
comment:1 by , 10 years ago
| Summary: | Changing CharField to GenericIpAddress post postgresql should use "using field::inet" → Changing CharField to GenericIPAddressField with PostgreSQL should use "using field::inet" |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → New feature |
| Version: | 1.8 → master |
comment:2 by , 10 years ago
This looks related to #25002 (73040e584a9ccc770593a3885f5fe40fda142e0d). Can you confirm this is working using the master branch?
comment:4 by , 10 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Duplicate of #25002. Backport was discussed briefly there and declined.
Note:
See TracTickets
for help on using tickets.
If not too difficult to implement, that would be useful. If not, we should document that using RawSQL is required for such cases.