Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] cidr

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] cidr
Date: 1998-07-24 16:00:16
Message-ID: (view raw or whole thread)
Lists: pgsql-hackers
> Thus spake Bruce Momjian
> > > >   host/netmask
> > > Converted internally to
> > 
> > This is a problem.  Suppose you have:
> > 
> >
> > 
> > This is a host with netmask, while:
> > 
> >
> > 
> > is a network address.  Paul?
> I believe that these two representations refer to the same thing.  Whether
> that thing is a network or an address depends on the application.  Either
> the column is being used to store networks or hosts.  That's what I was
> getting at with my previous analogy with int types.  An int could hold
> ordinal numbers like IDs or it could hold quantities.  We don't need
> the data type to store which.  The application knows and we don't store
> ID codes and counts in the same column.  The same with IP numbers.  We
> decide in any particular application whether a column is a list of hosts
> or a list of networks and we then populate it.
> I do like the idea of using attypmod to define the form of the type.
> I assume we can use that to determine the output format, that is, use
> it to effectively apply one of the functions to it.  That makes for
> a clean use of the type.

OK.  Sounds good to me.  The only problem is display.  If we don't
indicate whether it is a cidr or host/netmask on column creation or
insertion, how do we display it so it makes sense?  Always cidr?

> > > >  host?/netmask
> > > But or gives all the information
> > > that you need.
> > 
> > See example above.  You use the 3 here to know it is a host, because the
> > IP address extens past the netmask, but what if they are zeros?
> Technically, is a valid host on 192.0.0 although most
> people avoid it because some older equipment doesn't handle it very
> well.
> > > You mean printing netmasks?  As I said, it seems to me that netmasks will
> > > always be paired with a host or network but perhaps we can set up the
> > > function table so that netmask on an integer type converts to a netmask
> > > in the form you suggest.  That would be the truly oo way to do it.
> > 
> > Certainly we could, but it seems nice to have one type just for ip-type
> > stuff.
> I agree.  I'm just saying that we can add the netmask function to integer
> as well.  That gives someone the flexibility to store it either way.
> However, I don't think I am going to speak to this point again until
> someone can give me a single example of a requirement for storing
> netmasks independent of any hosts or networks.  :-)

OK.  Why not?

> I just thought of another useful function.
>     broadcast('') ==

Bruce Momjian                          |  830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-07-24 16:05:05
Subject: Re: [DOCS] Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]
Previous:From: Bruce TongDate: 1998-07-24 12:42:13
Subject: Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group