Handles empty aclitems
This commit is contained in:
@@ -3022,6 +3022,12 @@ func decodeAclItemArray(vr *ValueReader) []AclItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
str := vr.ReadString(vr.Len())
|
str := vr.ReadString(vr.Len())
|
||||||
|
|
||||||
|
// short-circuit empty array
|
||||||
|
if str == "{}" {
|
||||||
|
return []AclItem{}
|
||||||
|
}
|
||||||
|
|
||||||
// remove the '{' at the front and the '}' at the end
|
// remove the '{' at the front and the '}' at the end
|
||||||
str = str[1 : len(str)-1]
|
str = str[1 : len(str)-1]
|
||||||
strs := strings.Split(str, ",")
|
strs := strings.Split(str, ",")
|
||||||
|
|||||||
@@ -662,6 +662,9 @@ func TestAclArrayDecoding(t *testing.T) {
|
|||||||
tests := []struct {
|
tests := []struct {
|
||||||
query []pgx.AclItem
|
query []pgx.AclItem
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
[]pgx.AclItem{},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
[]pgx.AclItem{"=r/postgres"},
|
[]pgx.AclItem{"=r/postgres"},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user