Opened 9 years ago

Closed 9 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 Tim Graham, 9 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: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 1.8master

If not too difficult to implement, that would be useful. If not, we should document that using RawSQL is required for such cases.

comment:2 by Simon Charette, 9 years ago

This looks related to #25002 (73040e584a9ccc770593a3885f5fe40fda142e0d). Can you confirm this is working using the master branch?

comment:3 by no, 9 years ago

@charettes, looks like it works on master. Any chance of a backport?

comment:4 by Tim Graham, 9 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #25002. Backport was discussed briefly there and declined.

Note: See TracTickets for help on using tickets.
Back to Top