> Thus spake Bruce Momjian
> > > > 192.0.0.3:255.255.0.0 host/netmask
> > > Converted internally to 192.0.0.3:/16
> > This is a problem. Suppose you have:
> > 192.0.0.0:255.255.255.0
> > This is a host with netmask, while:
> > 192.0.0.0/24
> > 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?
> > > > 192.0.0.3/32:255.255.255.0 host?/netmask
> > > But 192.0.0.3/24 or 192.0.0.3:255.255.255.0 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, 192.0.0.0/24 is a valid host on 192.0.0 although most
> people avoid it because some older equipment doesn't handle it very
> > > 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('126.96.36.199/24::cidr') == 188.8.131.52
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 Momjian||Date: 1998-07-24 16:05:05|
|Subject: Re: [DOCS] Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]|
|Previous:||From: Bruce Tong||Date: 1998-07-24 12:42:13|
|Subject: Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]|