mirror of
https://github.com/jackc/pgx.git
synced 2025-05-24 16:29:54 +00:00
Handles empty aclitems
This commit is contained in:
parent
b12a1bb8bc
commit
9b8e3043ba
@ -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"},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user