2
0

SelectValue(s) require exactly one column

This commit is contained in:
Jack Christensen
2013-06-29 13:39:35 -05:00
parent 3acfffc142
commit 6339e54be4
2 changed files with 29 additions and 0 deletions
+10
View File
@@ -236,6 +236,11 @@ func TestConnectionSelectValue(t *testing.T) {
if _, ok := err.(NotSingleRowError); !ok {
t.Error("Multiple matching rows should have returned NotSingleRowError")
}
_, err = conn.SelectValue("select 'Matthew', 'Mark'")
if _, ok := err.(UnexpectedColumnCountError); !ok {
t.Error("Multiple columns should have returned UnexpectedColumnCountError")
}
}
func TestSelectValues(t *testing.T) {
@@ -262,4 +267,9 @@ func TestSelectValues(t *testing.T) {
test("select * from (values ('Matthew'), ('Mark'), ('Luke'), ('John')) t", []interface{}{"Matthew", "Mark", "Luke", "John"})
test("select * from (values ('Matthew'), (null)) t", []interface{}{"Matthew", nil})
test("select * from (values (1::int4), (2::int4), (null), (3::int4)) t", []interface{}{int32(1), int32(2), nil, int32(3)})
_, err := conn.SelectValues("select 'Matthew', 'Mark'")
if _, ok := err.(UnexpectedColumnCountError); !ok {
t.Error("Multiple columns should have returned UnexpectedColumnCountError")
}
}