PostgreSQL has a rich set of native data types available to users. Users may add new types to PostgreSQL using the CREATE TYPE command.
표 8-1 shows all the built-in general-purpose data types. Most of the alternative names listed in the "Aliases" column are the names used internally by PostgreSQL for historical reasons. In addition, some internally used or deprecated types are available, but they are not listed here.
표 8-1. ÀÚ·áÇü
À̸§ | º°Äª | ¼³¸í |
---|---|---|
bigint | int8 | ºÎÈ£ÀÖ´Â 8¹ÙÀÌÆ® Á¤¼ö |
bigserial | serial8 | ÀÚµ¿Áõ°¡ 8¹ÙÀÌÆ® Á¤¼ö |
bit [ (n) ] | °íÁ¤±æÀÌ ºñÆ® ¹®ÀÚ¿ | |
bit varying [ (n) ] | varbit | °¡º¯±æÀÌ ºñÆ® ¹®ÀÚ¿ |
boolean | bool | ³í¸®Àû ºÒ¸°Çü (true/false) |
box | Æò¸é¿¡¼ Ç¥ÇöµÇ´Â »ç°¢Çü | |
bytea | ÀÌÁø ÀÚ·á ("¹ÙÀÌÆ® ¹è¿") | |
character varying [ (n) ] | varchar [ (n) ] | °¡º¯±æÀÌ ¹®ÀÚ¿ |
character [ (n) ] | char [ (n) ] | °íÁ¤±æÀÌ ¹®ÀÚ¿ |
cidr | IPv4 ¶Ç´Â IPv6 ³×Æ®¿öÅ© ÁÖ¼Ò | |
circle | Æò¸é¿¡¼ÀÇ ¿ø | |
date | ´Þ·Â ³¯Â¥ (³â, ¿ù, ÀÏ) | |
double precision | float8 | µÎ¹è Á¤¹ÐµµÀÇ ºÎµ¿¼Ò¼öÁ¡ ¼ýÀÚ |
inet | IPv4 ¶Ç´Â IPv6 È£½ºÆ® ÁÖ¼Ò | |
integer | int, int4 | ºÎÈ£ ÀÖ´Â 4¹ÙÀÌÆ® Á¤¼ö |
interval [ (p) ] | ½Ã°£ °£°Ý | |
line | infinite line in the plane | |
lseg | line segment in the plane | |
macaddr | MAC ÁÖ¼Ò | |
money | ÅëÈ ÈÆó | |
numeric [ (p, s) ] | decimal [ (p, s) ] | Á¤¹Ðµµ¸¦ ÁöÁ¤ÇÒ ¼ö ÀÖ´Â ¹ü¿ë ¼ýÀÚ |
path | Æò¸é¿¡¼ Áö¸®Àû °æ·Î | |
point | Æò¸é¿¡¼ Áö¸®Àû À§Ä¡ | |
polygon | Æò¸é¿¡¼ÀÇ ´Ù°¢Çü | |
real | float4 | ºÎµ¿¼Ò¼öÁ¡ ¼ýÀÚ |
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 | Áö¿ª½Ã°£´ë¸¦ Æ÷ÇÔÇÏ´Â ³¯Â¥¿Í ½Ã°£ |
ȣȯ¼º: ´ÙÀ½ ÀÚ·áÇüµéÀº SQL¿¡ ÀÇÇØ ÁöÁ¤µÈ °ÍµéÀÌ´Ù: 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).
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 possibilities for formats, such as the date and time types. Some of the input and output functions are not invertible. That is, the result of an output function may lose accuracy when compared to the original input.