I l @ ve RuBoard |
PostgreSQL includes many functions that are network oriented. Primarily, these are useful for performing calculations and transformations of IP- related data. The following sections discuss the included network functions in PostgreSQL. ABBREVDescriptionThe ABBREV function returns an abbreviated text format for a supplied inet or cidr value. InputABBREV( inet cidr ) ExampleABBREV('192.168.0.0/24') "192.168/24" BROADCASTDescriptionThe BROADCAST function returns the broadcast address of the supplied inet or cidr value. InputBROADCAST( inet cidr ) ExampleBROADCAST('192.168.0.1/24') '192.168.0.255/24' HOSTDescriptionThe HOST function extracts the host address for the supplied inet or cidr value. InputHOST( inet cidr ) ExampleHOST('192.168.0.101/24') '192.168.0.101' MASKLENDescriptionThe MASKLEN function extracts the netmask length for the supplied inet or cidr value. InputMASKLEN( inet cidr ) ExampleMASKLEN('192.168.0.1/24') 24 NETMASKDescriptionThe NETMASK function calculates the netmask for the supplied inet or cidr value. InputNETMASK( inet cidr ) ExampleNETMASK('192.168.0.1/24') '255.255.255.0' NETWORKDescriptionThe NETWORK function extracts the network from a supplied inet or cidr value. InputNETWORK( inet cidr ) ExampleNETWORK('192.168.0.155/24') '192.168.1.0/24' TEXTDescriptionThe TEXT function returns the IP and netmask length as a text value. InputTEXT( inet cidr ) ExampleTEXT(CIDR '192.168.0.1/24') "192.168.0.1/24" TRUNCDescriptionThe TRUNC function sets the last 3 bytes to zero for the supplied macaddr value. InputTRUNC(macaddr) ExampleTRUNC(macaddr '33:33:33:33:33:aa') '33:33:33:00:00:00' NotesThis function is useful for associating a supplied MAC address with a manufacturer. See the directory $SOURCE/ contrib /mac ( SOURCE is the location of the PostgreSQL source code) for more information. |
I l @ ve RuBoard |