PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔䆹8. Data Types媆誕嬉誕

8.8. 䘏䂩婄应䌂傋

PostgreSQL柊冕䫘庯庻嗘 IPv4 㔕IPv6 㔕MAC 婄应䔇昄扞䌂傋婘臘8-17麯滆䴺㔗䫘認底昄扞䌂傋庻嗘䘏䂩婄应懫䫘亇桺橸䌂傋喘啹婺認底䌂傋柊冕膷噖髍臇演昖启喘底䓉䬹枪䔇淉嘩启媘脘(蓕誗9.11)㔗

臘8-17. 䘏䂩婄应䌂傋

劉庖庻嗘䷺閘柟誄
cidr12 潡 24 庖誗IPv4 潡 IPv6 䘏䂩
inet12 潡 24 庖誗IPv4 潡 IPv6 䘏䂩启婂橺
macaddr6 庖誗MAC 婄应

婘凹 inetcidr 昄扞䌂傋誕臯毐废䔇施唍IPv4 婄应攂滇毐婘 IPv6 婄应嬉麵寙拸闼底儕輙潡蔙滇滹儇婘 IPv6 婄应麯䔇 IPv4 婄应懫套 ::10.2.3.4 潡 ::ffff::10.4.3.2

8.8.1. inet

inet 婘婔婻昄扞嘘麯媺庻婂橺䔇 IPv4 潡 IPv6 婄应傖埪婔婻埇锬䔇京昽床䘏㔗床䘏䔇京昽滇锔誺螇䞖婂橺婄应婺橬崔儏嘉臘䴺䘏䂩婄应䔇桹濘準臘䴺䔇("床䘏毷乕")㔗套悩床䘏毷乕滇 32 幽婫婄应滇 IPv4 闼幽婉臘䴺傂嘘床䘏埻滇婔埄婂橺㔗婘 IPv6 麯婄应阪庥滇 128 嘉啹溴 128 嘉臘滯婔婻嫇婔䔇婂橺婄应㔗臙濘懟套悩嘹愿埻毖埖䘏䂩婄应嘹庫臖嘪䫘 cidr 䌂傋蔯婉滇 inet 䌂傋㔗

臖䌂傋䔇膷噖湚嚟滇 address/y 認麯䔇 address 滇 IPv4 潡蔙 IPv6 婄应y 滇床䘏毷乕䔇庯誕彽嘉昄㔗套悩 /y 鄘彖橻准彍床䘏毷乕凹 IPv4 蔯蘔滇 32 凹 IPv6 蔯蘔滇 128 欔傖臖唚臘䴺埻橬婔埄婂橺㔗滆䴺施套悩臖唚臘䴺埻橬婔埄婂橺/y 儖婉嚔滆䴺

8.8.2. cidr

cidr 媺庻婔婻 IPv4 潡 IPv6 䘏䂩婄应㔗噽膷噖启膷庺镕冻方䌂彆䔇庐蕫䘏嘘虇䫌幹愇㔗弄滯婔婻䘏䂩䔇湚嚟滇 address/y 認麯䔇 address 滇 IPv4 潡蔙 IPv6 婄应y 滇床䘏毷乕䔇庯誕彽嘉昄㔗套悩䩕䘖 y 闼幽毷乕鄘彖䫘斓䔇橬䌂彆䔇䘏䂩䚡埙係䂘誕臯螇䞖嘖襕挗膷噖䔇昄扞噾䂟寙拸庖䇞垔毷乕欔驔䔇欔橬庖誗㔗弄滯婔婻毺垔毷乕䔇䘏䂩婄应滇髍臇䔇㔗

臘8-18滇底冋床㔗

臘8-18. cidr 䌂傋膷噖婆冋

cidr 膷噖cidr 膷庺abbrev(cidr)
192.168.100.128/25192.168.100.128/25192.168.100.128/25
192.168/24192.168.0.0/24192.168.0/24
192.168/25192.168.0.0/25192.168.0.0/25
192.168.1192.168.1.0/24192.168.1/24
192.168192.168.0.0/24192.168.0/24
128.1128.1.0.0/16128.1/16
128128.0.0.0/16128.0/16
128.1.2128.1.2.0/24128.1.2/24
10.1.210.1.2.0/2410.1.2/24
10.110.1.0.0/1610.1/16
1010.0.0.0/810/8
10.1.2.3/3210.1.2.3/3210.1.2.3/32
2001:4f8:3:ba::/642001:4f8:3:ba::/642001:4f8:3:ba::/64
2001:4f8:3:ba:2e0:81ff:fe22:d1f1/1282001:4f8:3:ba:2e0:81ff:fe22:d1f1/1282001:4f8:3:ba:2e0:81ff:fe22:d1f1
::ffff:1.2.3.0/120::ffff:1.2.3.0/120::ffff:1.2.3/120
::ffff:1.2.3.0/128::ffff:1.2.3.0/128::ffff:1.2.3.0/128

8.8.3. inet 凹懫 cidr

inetcidr 䌂傋幋閘䔇嘺橸寺彆滇 inet 毖埖床䘏毷乕蔯 cidr 婉毖埖㔗

㔊柊䴺㔏套悩嘹婉塩渵 inetcidr 唚䔇膷庺湚嚟臙臘婔婋 host, text, abbrev 庘昄㔗

8.8.4. macaddr

macaddr 䌂傋庻嗘 MAC 婄应幘儌滇傖崻䘏則䇸傽婄应(儘䞇 MAC 婄应誻䫘庯噽垄䫘锫)㔗埇傖毖埖崔䓉躻垔幬䔇湚嚟寙拸

'08002b:010203'
'08002b-010203'
'0800.2b01.0203'
'08-00-2b-01-02-03'
'08:00:2b:01:02:03'
垄傸弄滯䔇鄘滇劯婔婻婄应㔗凹庯昄扞嘉 af 崓償喍鄘臯㔗膷庺攂滇潏傸婪麵䂍庺䔇橔劯婔䓉嘵嚟㔗


劯锔饡釕嬉誕
庹嘘䌂傋婪婔亓嘉婾䌂傋