Handles empty aclitems

This commit is contained in:
Manni Wood 2016-11-12 12:46:31 -05:00
parent b12a1bb8bc
commit 9b8e3043ba
2 changed files with 9 additions and 0 deletions

View File

@ -3022,6 +3022,12 @@ func decodeAclItemArray(vr *ValueReader) []AclItem {
}
str := vr.ReadString(vr.Len())
// short-circuit empty array
if str == "{}" {
return []AclItem{}
}
// remove the '{' at the front and the '}' at the end
str = str[1 : len(str)-1]
strs := strings.Split(str, ",")

View File

@ -662,6 +662,9 @@ func TestAclArrayDecoding(t *testing.T) {
tests := []struct {
query []pgx.AclItem
}{
{
[]pgx.AclItem{},
},
{
[]pgx.AclItem{"=r/postgres"},
},