On 18/12/06, Don Arbow <[EMAIL PROTECTED]> wrote:
>
> On Dec 17, 2006, at 9:16 AM, Jamie wrote:
> >
> > Hello,
> >
> > I'm just wondering if there's a specific reason why IPAddressField is
> > defined as a 15-character string instead of a 32-bit integer? Using an
> > integer would reduce the storage size by 15 bytes to only four bytes
> > and make it easier to calculate ranges. Additionally, on MySQL, it's
> > about 30% faster to scan for an IP address when it's an integer and
> > not
> > a string on a non-indexed column.
>
>
>
> Probably because Postgres has a column type that can accept strings
> in IPv4, IPv6 and cidr formats (with comparison and masking
> functions), so there was never any need for IP conversion routines
> before other databases were added.
>
> For example, in Postgres you can do this:
>
>      select * from table where ip_column < inet '192.168.1.6';
>
> or even trickier (select all within a subnet):
>
>      select * from table where inet '192.168.1/24' >> ip_column;
>
> If you need that functionality, you could post a ticket and/or a
> suggested fix.
>
> Don
>

Django's use of Postgres' inet data type is bad. See
http://code.djangoproject.com/ticket/708 for previous threads on this
and where things start to break. Django should use char(15) or
integers consistently across all backends.


regards

matthew

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to