{"id":2082,"date":"2014-10-22T03:06:03","date_gmt":"2014-10-22T03:06:03","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=2082"},"modified":"2017-01-27T10:40:22","modified_gmt":"2017-01-27T01:40:22","slug":"postgresql%ec%9d%98-%ed%99%95%ec%9e%a5-%ea%b8%b0%eb%8a%a5-hstore","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=2082","title":{"rendered":"PostgreSQL\uc758 \ud655\uc7a5 \uae30\ub2a5 HStore"},"content":{"rendered":"<p><P>GIS \ubd84\uc57c\uc758 \uac1c\ubc1c\uc790\ub85c\uc368 PostgreSQL\uc740 \uc815\ub9d0 \uc88b\uc740 DBMS\uc785\ub2c8\ub2e4. \uacf5\uac04DB\ub97c \uc704\ud55c PostGIS\uc758 \ud655\uc7a5 \uae30\ub2a5\uc774 \ub2e8\uc5f0 \uc73c\ub738\uc774\uad6c\uc694. \ud3c9\uc18c PostgreSQL\uc5d0 \ub300\ud574 \ub9ce\uc740 \uad00\uc2ec\uc744 \uac16\ub358 \uc911 \ud655\uc7a5 \uae30\ub2a5\uc73c\ub85c\uc368 PostGIS \uc774\uc678\uc5d0 \ub610 \ub2e4\ub978 \ud655\uc7a5 \uae30\ub2a5\uc774 \ubb34\uc5c7\uc778\uc9c0\ub97c \uc0b4\ud3b4\ubcf4\ub2e4\uac00 HStore\ub77c\ub294 \uae30\ub2a5\uc744 \uc54c\uac8c \ub418\uc5c8\ub294\ub370\uc694. \uc774 \uae30\ub2a5\uc740 Key \/ Value\ub77c\ub294 \ub2e8\uc21c\ud55c \uad6c\uc870\ub97c \uac16\ub294 \ud14c\uc774\ube14\uc744 \uc815\uc758\ud560 \uc218 \uc788\ub294 \ud655\uc7a5\uc785\ub2c8\ub2e4. <\/P><\/p>\n<p><P>\ud574\uc11c.. \uac04\ub2e8\ud788 HStore\ub77c\ub294 \uae30\ub2a5\uc5d0 \ub300\ud55c \uc0ac\uc6a9 \uc608\ub97c \uc815\ub9ac\ud574 \ubd05\ub2c8\ub2e4. HStore\ub294 PostgresSQL\uc5d0\uc11c \uae30\ubcf8\uc801\uc73c\ub85c \uc81c\uacf5\ub418\ubbc0\ub85c PostGIS\ucc98\ub7fc \ubcc4\ub3c4\uc758 \uc124\uce58\ub294 \ud544\uc694\uce58 \uc54a\uc2b5\ub2c8\ub2e4. \uc800 \uac19\uc740 \uacbd\uc6b0 PostgreSQL 9.3\uc744 \uc0ac\uc6a9\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ud639, HStore\uac00 \uc9c0\uc6d0\ub418\uc9c0 \uc54a\ub294\ub2e4\uace0 \ud310\ub2e8\ub420 \uacbd\uc6b0 \ucd5c\uc2e0\ubc84\uc804\uc744 \uc0ac\uc6a9\ud574 \ubcf4\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4.<\/P><\/p>\n<p><P>\uc124\uce58\ub41c PostgreSQL\uc5d0\uc11c HStore\ub97c \ud55c\ubc88\ub3c4 \uc0ac\uc6a9\ud574 \ubcf4\uc9c0 \uc54a\uc558\ub2e4\uba74 \ub2e4\uc74c\uacfc \uac19\uc740 \uba85\ub839\uc744 \ud1b5\ud574 HStore\ub97c \ud65c\uc131\ud654 \uc2dc\ucf1c\uc57c \ud569\ub2c8\ub2e4. \ud55c\ubc88 \ud65c\uc131\ud654\ub418\uba74 \ub9e4\ubc88 \ub2e4\uc2dc \ud65c\uc131\ud654\ud560 \ud544\uc694\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<pre>\r\nCREATE EXTENSION hstore;\r\n<\/pre>\n<p><P>\uc774\uc81c HStore\ub97c \uc774\uc6a9\ud574\uc11c \uac04\ub2e8\ud55c \uc8fc\uc18c\ub85d \ud14c\uc774\ube14\uc744 \ub9cc\ub4e4\uc5b4 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<pre>\r\nCREATE TABLE AddressBook (\r\n    id serial PRIMARY KEY,    \r\n    name varchar,\r\n    attributes hstore\r\n);\r\n<\/pre>\n<p><P>hstore \ud0c0\uc785\uc758 attributes \ud544\ub4dc\uac00 \ud575\uc2ec\uc785\ub2c8\ub2e4. \uc774\uc81c \uc774 \ud14c\uc774\ube14\uc5d0 3\uac1c\uc758 \ub808\ucf54\ub4dc\ub97c \uc785\ub825\ud558\uaca0\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<pre>\r\nINSERT INTO AddressBook (name, attributes) VALUES (\r\n    '\uae40\ud615\uc900',\r\n    'age => 38,\r\n     telephone => \"010-9438-3224\",\r\n     email  => \"hjkim@geoservice.co.kr\"'\r\n);\r\n\r\nINSERT INTO AddressBook (name, attributes) VALUES (\r\n    '\uc77c\uc9c0\ub9e4',\r\n    'age => 27,\r\n     telephone => \"N\/A\",\r\n     email  => \"jime@korea.kr\"'\r\n);\r\n\r\nINSERT INTO AddressBook (name, attributes) VALUES (\r\n    '\ud64d\uae38\ub3d9',\r\n    'age => 18,\r\n     telephone => \"N\/A\",\r\n     email  => \"gildong@josun.kr\"'\r\n );\r\n<\/pre>\n<p><P>hstore \ud0c0\uc785\uc758 attributes \ud544\ub4dc\uc758 \uac12\uc744 \uc785\ub825\ud558\ub294 \ubc29\uc2dd\uc774 \ub2e4\uc218\uc758 Key, Value\uc5d0 \ub300\ud55c \ubb38\uc790\uc5f4\uc784\uc744 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4. Key\uc640 Value\uc758 \uad6c\ubd84\uc740 => \ub97c \uc0ac\uc6a9\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4 !<\/P><\/p>\n<p><P>\uc774\uc81c \uc774\ub807\uac8c \uc785\ub825\ud55c \ub370\uc774\ud130\uc14b\uc73c\ub85c\ubd80\ud130 \ub370\uc774\ud130 \uc9c8\uc758(Query)\ub97c \ud574\ubcf4\uaca0\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<pre>\r\nSELECT name, attributes FROM AddressBook;\r\n<\/pre>\n<p><P>\uacb0\uacfc\ub294 \uc544\ub798\uc640 \uac19\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1402544371.png\" \/><\/p>\n<p><P>\ub2e4\uc74c\uc740 Key\uc5d0 \ub300\ud574 \uc870\uac74\uc744 \uac78\uc5b4 \uac80\uc0c9\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4. Key \uc911 \uc804\ud654(telephone)\uac00 &#8216;N\/A&#8217; \uac12\uc73c\ub85c \uc785\ub825 \ub41c \ub808\ucf54\ub4dc\ub97c \uc870\ud68c\ud558\ub294 \uac83\uc785\ub2c8\ub2e4. \uc544\ub798\uc640 \uac19\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<pre>\r\nSELECT name, attributes FROM AddressBook WHERE attributes->'telephone' = 'N\/A';\r\n<\/pre>\n<p><P>\uacb0\uacfc\ub294 \uc608\uc0c1\ud588\ub358 \uac83\ucc98\ub7fc \uc544\ub798\uc640 \uac19\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/1\/1338409080.png\" \/><\/p>\n<p><P>\uc774 HStore\ub77c\ub294 \ub140\uc11d\uc744 \uc5b4\ub5bb\uac8c, \uc5b4\ub514\uc5d0 \ud65c\uc6a9\ud560 \uc218 \uc788\uc744\uae4c \uc0dd\uac01\ud574 \ubd10\uc57c \uaca0\uc2b5\ub2c8\ub2e4.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GIS \ubd84\uc57c\uc758 \uac1c\ubc1c\uc790\ub85c\uc368 PostgreSQL\uc740 \uc815\ub9d0 \uc88b\uc740 DBMS\uc785\ub2c8\ub2e4. \uacf5\uac04DB\ub97c \uc704\ud55c PostGIS\uc758 \ud655\uc7a5 \uae30\ub2a5\uc774 \ub2e8\uc5f0 \uc73c\ub738\uc774\uad6c\uc694. \ud3c9\uc18c PostgreSQL\uc5d0 \ub300\ud574 \ub9ce\uc740 \uad00\uc2ec\uc744 \uac16\ub358 \uc911 \ud655\uc7a5 \uae30\ub2a5\uc73c\ub85c\uc368 PostGIS \uc774\uc678\uc5d0 \ub610 \ub2e4\ub978 \ud655\uc7a5 \uae30\ub2a5\uc774 \ubb34\uc5c7\uc778\uc9c0\ub97c \uc0b4\ud3b4\ubcf4\ub2e4\uac00 HStore\ub77c\ub294 \uae30\ub2a5\uc744 \uc54c\uac8c \ub418\uc5c8\ub294\ub370\uc694. \uc774 \uae30\ub2a5\uc740 Key \/ Value\ub77c\ub294 \ub2e8\uc21c\ud55c \uad6c\uc870\ub97c \uac16\ub294 \ud14c\uc774\ube14\uc744 \uc815\uc758\ud560 \uc218 \uc788\ub294 \ud655\uc7a5\uc785\ub2c8\ub2e4. \ud574\uc11c.. \uac04\ub2e8\ud788 HStore\ub77c\ub294 \uae30\ub2a5\uc5d0 \ub300\ud55c \uc0ac\uc6a9 \uc608\ub97c &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=2082\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;PostgreSQL\uc758 \ud655\uc7a5 \uae30\ub2a5 HStore&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-2082","post","type-post","status-publish","format-standard","hentry","category-opensource"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2082"}],"version-history":[{"count":1,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2082\/revisions"}],"predecessor-version":[{"id":2832,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/2082\/revisions\/2832"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2082"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}