From bf2f7543addba92e15e5a28a73c5e80792f8de01 Mon Sep 17 00:00:00 2001 From: "sam.corzine" Date: Fri, 2 Oct 2020 15:36:50 -0500 Subject: [PATCH 1/4] fix read --- redshift/resource_redshift_group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redshift/resource_redshift_group.go b/redshift/resource_redshift_group.go index 30427b4..d03f4c8 100644 --- a/redshift/resource_redshift_group.go +++ b/redshift/resource_redshift_group.go @@ -141,7 +141,7 @@ func readRedshiftGroup(d *schema.ResourceData, tx *sql.Tx) error { //Notes on postgres array types https://gist.github.com/adharris/4163702, eg startying with underscore _int4 - if users.Valid { + if users.Valid && users.String != "" { var userIdsAsString = strings.Split(users.String[1:len(users.String)-1], ",") var userIdsAsInt = []int{} From e1f7537023af71f98a550e9fdce858382e1498f2 Mon Sep 17 00:00:00 2001 From: "sam.corzine" Date: Fri, 2 Oct 2020 16:17:59 -0500 Subject: [PATCH 2/4] temp --- redshift/resource_redshift_group.go | 1 + 1 file changed, 1 insertion(+) diff --git a/redshift/resource_redshift_group.go b/redshift/resource_redshift_group.go index 30427b4..1904c0c 100644 --- a/redshift/resource_redshift_group.go +++ b/redshift/resource_redshift_group.go @@ -148,6 +148,7 @@ func readRedshiftGroup(d *schema.ResourceData, tx *sql.Tx) error { for _, i := range userIdsAsString { j, err := strconv.Atoi(i) if err != nil { + panic(i) panic(err) } userIdsAsInt = append(userIdsAsInt, j) From bb5e2ec2f45b08a468b133a37a85dee89badb1ca Mon Sep 17 00:00:00 2001 From: "sam.corzine" Date: Fri, 2 Oct 2020 16:59:17 -0500 Subject: [PATCH 3/4] temp fix --- redshift/resource_redshift_group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redshift/resource_redshift_group.go b/redshift/resource_redshift_group.go index e7b55a0..9604396 100644 --- a/redshift/resource_redshift_group.go +++ b/redshift/resource_redshift_group.go @@ -141,7 +141,7 @@ func readRedshiftGroup(d *schema.ResourceData, tx *sql.Tx) error { //Notes on postgres array types https://gist.github.com/adharris/4163702, eg startying with underscore _int4 - if users.Valid && users.String != "" { + if users.Valid && users.String != "{}" { var userIdsAsString = strings.Split(users.String[1:len(users.String)-1], ",") var userIdsAsInt = []int{} From f1f7b53c4bce81e82fb3249f084d1e51194e87ac Mon Sep 17 00:00:00 2001 From: "sam.corzine" Date: Fri, 2 Oct 2020 17:17:28 -0500 Subject: [PATCH 4/4] fix panic --- redshift/resource_redshift_group.go | 1 - 1 file changed, 1 deletion(-) diff --git a/redshift/resource_redshift_group.go b/redshift/resource_redshift_group.go index 9604396..16778b8 100644 --- a/redshift/resource_redshift_group.go +++ b/redshift/resource_redshift_group.go @@ -148,7 +148,6 @@ func readRedshiftGroup(d *schema.ResourceData, tx *sql.Tx) error { for _, i := range userIdsAsString { j, err := strconv.Atoi(i) if err != nil { - panic(i) panic(err) } userIdsAsInt = append(userIdsAsInt, j)