PostgreSQL¿¡¼´Â »ç¿ëÀÚµéÀÌ ¾µ ¼ö ÀÖ´Â ¸¹Àº ±âº» ÀÚ·áÇüÀ» Á¦°øÇÏ°í ÀÖ´Ù. ¶ÇÇÑ, CREATE TYPE ¸í·ÉÀ» ÀÌ¿ëÇؼ »õ·Î¿î ÀÚ·áÇüÀ» Á÷Á¢ ¸¸µé¾î »ç¿ëÇÒ ¼ö ÀÖ´Ù.
PostgreSQL¿¡¼ ±âº»ÀûÀ¸·Î Á¦°øÇÏ´Â ¸ðµç ³»Àå ¹ü¿ë ÀÚ·áÇüÀº 표 8-1 ¸ñ·Ï°ú °°´Ù. "º°Äª" Ä®·³¿¡ ³ª¿µÈ ´ëü À̸§µéÀÇ ´ëºÎºÐÀº PostgreSQL ¿ª»çÀûÀÎ ÀÌÀ¯·Î ³»ºÎÀûÀ¸·Î »ç¿ëµÇ´Â °ÍµéÀÌ´Ù. µ¡ºÙ¿©, ³»ºÎÀûÀ¸·Î¸¸ »ç¿ëÇÏ´Â °ÍÀ̰ųª, ´õ ÀÌ»ó »ç¿ëµÇÁö ¾ÊÀ» ¿¾ ÀÚ·áÇüµéµµ ÀÖÁö¸¸, ±×°ÍµéÀº ¿©±â¼ ³ª¿ÇÏÁö ¾Ê´Â´Ù.
표 8-1. ÀÚ·áÇü
À̸§ | º°Äª | ¼³¸í |
---|---|---|
bigint | int8 | ºÎÈ£ ÀÖ´Â 8¹ÙÀÌÆ® Á¤¼öÇü |
bigserial | serial8 | ÀÚµ¿ Áõ°¡ 8¹ÙÀÌÆ® Á¤¼öÇü |
bit [ (n) ] | °íÁ¤ ±æÀÌ ºñÆ® ¹®ÀÚ¿ | |
bit varying [ (n) ] | varbit | °¡º¯ ±æÀÌ ºñÆ® ¹®ÀÚ¿ |
boolean | bool | ³í¸® ºÒ¸°Çü (Âü/°ÅÁþ) |
box | Æò¸é À§ Á÷°¢»ç°¢Çü | |
bytea | ÀÌÁøÀÚ·á ("¹ÙÀÌÆ® ¹è¿") | |
character varying [ (n) ] | varchar [ (n) ] | °¡º¯ °áÀÌ ¹®ÀÚ¿ |
character [ (n) ] | char [ (n) ] | °íÁ¤ ±æÀÌ ¹®ÀÚ¿ |
cidr | IPv4 ¶Ç´Â IPv6 ³×Æ®¿öÅ© ÁÖ¼Ò | |
circle | Æò¸é À§ ¿ø | |
date | ´Þ·Â ³¯Â¥ (³â, ¿ù, ÀÏ) | |
double precision | float8 | 2¹è Á¤¹Ð ºÎµ¿ ¼Ò¼öÇü (8 ¹ÙÀÌÆ®) |
inet | IPv4 ¶Ç IPv6 È£½ºÆ® ÁÖ¼Ò | |
integer | int, int4 | ºÎÈ£ ÀÖ´Â 4¹ÙÀÌÆ® Á¤¼öÇü |
interval [ fields ] [ (p) ] | ½Ã°£ °£°Ý | |
line | Æò¸é À§ ¹«ÇÑ Á÷¼± | |
lseg | Æò¸é À§ ¼±ºÐ | |
macaddr | MAC (¸Åü Á¢±Ù Á¦¾î) ÁÖ¼Ò | |
money | ÈÆóÇü | |
numeric [ (p, s) ] | decimal [ (p, s) ] | Á¤¹Ðµµ ¼±Åà °¡´ÉÇÑ ¼ýÀÚÇü |
path | Æò¸é À§ ±âÇÏÇÐÀû °æ·Î | |
point | Æò¸é À§ ±âÇÏÇÐÀû À§Ä¡ | |
polygon | Æò¸é À§ ±âÇÏÇÐÀû ´ÝÈù °æ·Î | |
real | float4 | ºÎµ¿¼Ò¼öÇü (4 ¹ÙÀÌÆ®) |
smallint | int2 | ºÎÈ£ÀÖ´Â 2¹ÙÀÌÆ® Á¤¼öÇü |
serial | serial4 | ÀÚµ¿ Áõ°¡ 4¹ÙÀÌÆ® Á¤¼öÇü |
text | °¡º¯ ±æÀÌ ¹®ÀÚ¿ | |
time [ (p) ] [ without time zone ] | ½Ã°¢ (Áö¿ª½Ã°£´ë ¾øÀ½) | |
time [ (p) ] with time zone | timetz | Áö¿ª½Ã°£´ë Æ÷ÇÔÇÑ ½Ã°¢ |
timestamp [ (p) ] [ without time zone ] | ³¯Â¥¿Í ½Ã°¢ (Áö¿ª½Ã°£´ë ¾øÀ½) | |
timestamp [ (p) ] with time zone | timestamptz | Áö¿ª½Ã°£´ë¸¦ Æ÷ÇÔÇÑ ³¯Â¥¿Í ½Ã°¢ |
tsquery | ÅؽºÆ® °Ë»ö Äõ¸® | |
tsvector | ÅؽºÆ® °Ë»ö ¹®¼ | |
txid_snapshot | »ç¿ëÀÚ-¼öÁØ Æ®·£Àè¼Ç ID ½º³À¼¦ | |
uuid | ¹ü¿ë °íÀ¯ ½Äº°ÀÚ | |
xml | XML ÀÚ·á |
ȣȯ¼º: The following types (or spellings thereof) are specified by SQL: bigint, bit, bit varying, boolean, char, character varying, character, varchar, date, double precision, integer, interval, numeric, decimal, real, smallint, time (with or without time zone), timestamp (with or without time zone), xml.
Each data type has an external representation determined by its input and output functions. Many of the built-in types have obvious external formats. However, several types are either unique to PostgreSQL, such as geometric paths, or have several possible formats, such as the date and time types. Some of the input and output functions are not invertible, i.e., the result of an output function might lose accuracy when compared to the original input.