インターネットプロトコル バージョン4 上の ネットワークアドレスとホストアドレス

The cidr type stores networks specified in CIDR (Classless Inter-Domain Routing) notation. The inet type stores hosts and networks in CIDR notation using a simple variation in representation to represent simple host TCP/IP addresses.

cidr 型は、CIDR (Classless Inter-Domain Routing) 表記されたネットワークアドレス (例:x.x.x.x/y)を格納します。 inet 型は、単純にホストの TCP/IP アドレスを表現 する、良く知られた簡略形 CIDR 表記で書かれたホストアドレス およびネットワークアドレスを格納します。

Table 3-19. Postgres インターネット プロトコル バージョン 4 のデータ型

IPV4 型記憶領域説明有効範囲
cidr可変長CIDR ネットワークIPV4 CIDR 表記で有効なブロック
inet可変長CIDR ネットワークIPV4 CIDR 表記で有効なブロック

CIDR 型

The cidr type holds a CIDR network. The format for specifying classless networks is x.x.x.x/y where x.x.x.x is the network and /y is the number of bits in the netmask. If /y omitted, it is calculated using assumptions from the older classfull naming system except that it is extended to include at least all of the octets in the input.

cidr 型は CIDR ネットワークアドレスを保存します。 クラス分けの無いネットワークアドレス (classless networks) を 指定するための書式は x.x.x.x/y で、 x.x.x.x は ネットワークアドレス、そして /y はネットマスク (netmask) のビット数です。 もし /y が省略された 場には、入力時に少なくともオクテットのすべてが含めれるように拡張されること以外 、古いクラス名付けシステムシステムの仮定から計算されます。

以下、参考例です:

Table 3-20. PostgresIP 型の例

CIDR 入力CIDR 表示
192.168.1192.168.1/24
192.168192.168.0/24
128.1128.1/16
128128.0/16
128.1.2128.1.2/24
10.1.210.1.2/24
10.110.1/16
1010/8

inet

The inet type is designed to hold, in one field, all of the information about a host including the CIDR-style subnet that it is in. Note that if you want to store proper CIDR networks, you should use the cidr type. The inet type is similar to the cidr type except that the bits in the host part can be non-zero. Functions exist to extract the various elements of the field.

inet 型は、1 つのフィールドで CIDR 表記のサブネット マスクをも含めた形で、ホストについての情報のすべてを保存するよう 設計されています。 もし正式な CIDR 表記のネットワークアドレスの保存が必要な場合、cidr 型を使うべきでしょう。 inet 型は、ホスト部分のビットがゼロでは無いこと以外、cidr 型に似ています。 幾つかの関数が、フィールドのいろいろな要素を抽出するために 存在しています。

The input format for this function is x.x.x.x/y where x.x.x.x is an internet host and y is the number of bits in the netmask. If the /y part is left off, it is treated as /32. On output, the /y part is not printed if it is /32. This allows the type to be used as a straight host type by just leaving off the bits part.

これらの関数を使う時の入力書式は x.x.x.x/y で、 x.x.x.x が インターネットホストアドレス、そして はネットマスクのビット数です。 もし /y の部分を省略 すると、それは /32 として扱われます。 出力時、 もし/y の部分が /32 の時は表示されません。 この部分を省略することによって、じかにホストアドレスとして 使用されることを可能にしています。