diff --git a/README.md b/README.md
index e6652f22..65e8bf5d 100644
--- a/README.md
+++ b/README.md
@@ -265,6 +265,10 @@ types. The driver currently supports the following conversions:
types::array::ArrayBase<Option<i64>>
INT8[], INT8[][], ...
+
+
std::hashmap::HashMap<~str, Option<~str>>
+
HSTORE
+
diff --git a/test.rs b/test.rs
index 0b8c6430..d1da03e3 100644
--- a/test.rs
+++ b/test.rs
@@ -12,6 +12,7 @@ use extra::uuid::Uuid;
use ssl::{SslContext, Sslv3};
use std::f32;
use std::f64;
+use std::hashmap::HashMap;
use std::io::timer;
use lib::{PostgresNoticeHandler,
@@ -447,6 +448,24 @@ fn test_int8array_params() {
[(Some(a), "'[-1:0][0:1]={{0,1},{NULL,3}}'")]);
}
+#[test]
+fn test_hstore_params() {
+ macro_rules! make_map(
+ ($($k:expr => $v:expr),+) => ({
+ let mut map = HashMap::new();
+ $(map.insert($k, $v);)+
+ map
+ })
+ )
+ test_type("hstore",
+ [(Some(make_map!(~"a" => Some(~"1"))), "'a=>1'"),
+ (Some(make_map!(~"hello" => Some(~"world!"),
+ ~"hola" => Some(~"mundo!"),
+ ~"what" => None)),
+ "'hello=>world!,hola=>mundo!,what=>NULL'"),
+ (None, "NULL")]);
+}
+
fn test_nan_param(sql_type: &str) {
let conn = PostgresConnection::connect("postgres://postgres@localhost", &NoSsl);
let stmt = conn.prepare("SELECT 'NaN'::" + sql_type);
diff --git a/types/mod.rs b/types/mod.rs
index c1bb0e09..ec7956dc 100644
--- a/types/mod.rs
+++ b/types/mod.rs
@@ -6,6 +6,7 @@ use extra::time::Timespec;
use extra::json;
use extra::json::Json;
use extra::uuid::Uuid;
+use std::hashmap::HashMap;
use std::io::Decorator;
use std::io::mem::{MemWriter, BufReader};
use std::mem;
@@ -143,6 +144,7 @@ impl PostgresType {
/// Returns the wire format needed for the value of `self`.
pub fn result_format(&self) -> Format {
match *self {
+ PgUnknownType { name: ~"hstore", .. } => Binary,
PgUnknownType { .. } => Text,
_ => Binary
}
@@ -379,6 +381,31 @@ from_option_impl!(ArrayBase