장 8. ÀÚ·áÇü

차례
8.1. Numeric Types
8.1.1. Integer Types
8.1.2. Arbitrary Precision Numbers
8.1.3. Floating-Point Types
8.1.4. Serial Types
8.2. Monetary Types
8.3. ¹®ÀÚ ÀÚ·áÇü
8.4. Binary Data Types
8.5. Date/Time Types
8.5.1. Date/Time Input
8.5.2. Date/Time Output
8.5.3. Time Zones
8.5.4. Interval Input
8.5.5. Interval Output
8.5.6. Internals
8.6. Boolean Type
8.7. Enumerated Types
8.7.1. Declaration of Enumerated Types
8.7.2. Ordering
8.7.3. Type Safety
8.7.4. Implementation Details
8.8. Geometric Types
8.8.1. Points
8.8.2. Line Segments
8.8.3. Boxes
8.8.4. Paths
8.8.5. Polygons
8.8.6. Circles
8.9. Network Address Types
8.9.1. inet
8.9.2. cidr
8.9.3. inet vs. cidr
8.9.4. macaddr
8.10. ºñÆ® ¹®ÀÚ¿­ ÀÚ·áÇü
8.11. Text Search Types
8.11.1. tsvector
8.11.2. tsquery
8.12. UUID Type
8.13. XML Type
8.13.1. Creating XML Values
8.13.2. Encoding Handling
8.13.3. Accessing XML Values
8.14. Arrays
8.14.1. Declaration of Array Types
8.14.2. Array Value Input
8.14.3. Accessing Arrays
8.14.4. Modifying Arrays
8.14.5. Searching in Arrays
8.14.6. Array Input and Output Syntax
8.15. Composite Types
8.15.1. Declaration of Composite Types
8.15.2. Composite Value Input
8.15.3. Accessing Composite Types
8.15.4. Modifying Composite Types
8.15.5. Composite Type Input and Output Syntax
8.16. Object Identifier Types
8.17. Pseudo-Types

PostgreSQL¿¡¼­´Â »ç¿ëÀÚµéÀÌ ¾µ ¼ö ÀÖ´Â ¸¹Àº ±âº» ÀÚ·áÇüÀ» Á¦°øÇÏ°í ÀÖ´Ù. ¶ÇÇÑ, CREATE TYPE ¸í·ÉÀ» ÀÌ¿ëÇؼ­ »õ·Î¿î ÀÚ·áÇüÀ» Á÷Á¢ ¸¸µé¾î »ç¿ëÇÒ ¼ö ÀÖ´Ù.

PostgreSQL¿¡¼­ ±âº»ÀûÀ¸·Î Á¦°øÇÏ´Â ¸ðµç ³»Àå ¹ü¿ë ÀÚ·áÇüÀº 표 8-1 ¸ñ·Ï°ú °°´Ù. "º°Äª" Ä®·³¿¡ ³ª¿­µÈ ´ëü À̸§µéÀÇ ´ëºÎºÐÀº PostgreSQL ¿ª»çÀûÀÎ ÀÌÀ¯·Î ³»ºÎÀûÀ¸·Î »ç¿ëµÇ´Â °ÍµéÀÌ´Ù. µ¡ºÙ¿©, ³»ºÎÀûÀ¸·Î¸¸ »ç¿ëÇÏ´Â °ÍÀ̰ųª, ´õ ÀÌ»ó »ç¿ëµÇÁö ¾ÊÀ» ¿¾ ÀÚ·áÇüµéµµ ÀÖÁö¸¸, ±×°ÍµéÀº ¿©±â¼­ ³ª¿­ÇÏÁö ¾Ê´Â´Ù.

표 8-1. ÀÚ·áÇü

À̸§º°Äª¼³¸í
bigintint8ºÎÈ£ ÀÖ´Â 8¹ÙÀÌÆ® Á¤¼öÇü
bigserialserial8ÀÚµ¿ Áõ°¡ 8¹ÙÀÌÆ® Á¤¼öÇü
bit [ (n) ] °íÁ¤ ±æÀÌ ºñÆ® ¹®ÀÚ¿­
bit varying [ (n) ]varbit°¡º¯ ±æÀÌ ºñÆ® ¹®ÀÚ¿­
booleanbool³í¸® ºÒ¸°Çü (Âü/°ÅÁþ)
box Æò¸é À§ Á÷°¢»ç°¢Çü
bytea ÀÌÁøÀÚ·á ("¹ÙÀÌÆ® ¹è¿­")
character varying [ (n) ]varchar [ (n) ]°¡º¯ °áÀÌ ¹®ÀÚ¿­
character [ (n) ]char [ (n) ]°íÁ¤ ±æÀÌ ¹®ÀÚ¿­
cidr IPv4 ¶Ç´Â IPv6 ³×Æ®¿öÅ© ÁÖ¼Ò
circle Æò¸é À§ ¿ø
date ´Þ·Â ³¯Â¥ (³â, ¿ù, ÀÏ)
double precisionfloat82¹è Á¤¹Ð ºÎµ¿ ¼Ò¼öÇü (8 ¹ÙÀÌÆ®)
inet IPv4 ¶Ç IPv6 È£½ºÆ® ÁÖ¼Ò
integerint, int4ºÎÈ£ ÀÖ´Â 4¹ÙÀÌÆ® Á¤¼öÇü
interval [ fields ] [ (p) ] ½Ã°£ °£°Ý
line Æò¸é À§ ¹«ÇÑ Á÷¼±
lseg Æò¸é À§ ¼±ºÐ
macaddr MAC (¸Åü Á¢±Ù Á¦¾î) ÁÖ¼Ò
money È­ÆóÇü
numeric [ (p, s) ]decimal [ (p, s) ]Á¤¹Ðµµ ¼±Åà °¡´ÉÇÑ ¼ýÀÚÇü
path Æò¸é À§ ±âÇÏÇÐÀû °æ·Î
point Æò¸é À§ ±âÇÏÇÐÀû À§Ä¡
polygon Æò¸é À§ ±âÇÏÇÐÀû ´ÝÈù °æ·Î
realfloat4ºÎµ¿¼Ò¼öÇü (4 ¹ÙÀÌÆ®)
smallintint2ºÎÈ£ÀÖ´Â 2¹ÙÀÌÆ® Á¤¼öÇü
serialserial4ÀÚµ¿ Áõ°¡ 4¹ÙÀÌÆ® Á¤¼öÇü
text °¡º¯ ±æÀÌ ¹®ÀÚ¿­
time [ (p) ] [ without time zone ] ½Ã°¢ (Áö¿ª½Ã°£´ë ¾øÀ½)
time [ (p) ] with time zonetimetzÁö¿ª½Ã°£´ë Æ÷ÇÔÇÑ ½Ã°¢
timestamp [ (p) ] [ without time zone ] ³¯Â¥¿Í ½Ã°¢ (Áö¿ª½Ã°£´ë ¾øÀ½)
timestamp [ (p) ] with time zonetimestamptzÁö¿ª½Ã°£´ë¸¦ Æ÷ÇÔÇÑ ³¯Â¥¿Í ½Ã°¢
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.