Thread: embedded sql interface to ip address type
Is there such thing? Is there an example? I have had no trouble with the embedded sql until now. The documentation is a bit thin but it's so close to everyone else's implementation it's a breeze, great work by the developers. -- Rob Fowler
On Fri, Mar 21, 2003 at 05:41:12PM +1100, Rob Fowler wrote: > Is there such thing? Is there an example? I have had no trouble with the What exactly do you mean? A C type for IP addresses? That doesn't exist. Right now this type has to be stored in character strings. I've just started working on a seperate lib to implement all the special types in C as well. But IP addresses is not on mytodo list for the near future. Michael -- Michael Meskes Email: Michael@Fam-Meskes.De ICQ: 179140304 Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
> What exactly do you mean? A C type for IP addresses? That doesn't > exist. Right now this type has to be stored in character strings. Thanks for the answer Michael. That was exactly what I meant and your answer was exactly what I needed. I thought I needed to bind the address structure to the ipaddr column but that did not work so I changed the type to text and converted the address to a char string. Now you tell me it's just text, I went back and changed the database datatype to inet address and it's all good. -- Rob Fowler
> What exactly do you mean? A C type for IP addresses? That doesn't > exist. Right now this type has to be stored in character strings. You mean base types written in C? We certainly do. darcy=# select '123.4.5.6'::inet << '123.4.5.0/24'::cidr;?column? ----------t (1 row) darcy=# select '123.4.5.6'::inet << '123.4.6.0/24'::cidr;?column? ----------f (1 row) The above says that the IP address 123.4.5.6 is in the CIDR block 123.4.5.0/24 but not in 123.4.6.0/24. We also have a MAC address type. See the documentation pages at http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=datatype-net-types.html and http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=functions-net.html for details. -- D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
On Sat, Mar 22, 2003 at 05:33:30AM -0500, D'Arcy J.M. Cain wrote: > > What exactly do you mean? A C type for IP addresses? That doesn't > > exist. Right now this type has to be stored in character strings. > > You mean base types written in C? We certainly do. Yes, we have that in PGSQL, but not as a seperate C library. In C you can only use char * so far. I'd like to have an implementation of CIDR as C types as well. Michael -- Michael Meskes Email: Michael@Fam-Meskes.De ICQ: 179140304 Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!