From 6e8fb576aa35adfc7d432b5a2e206c339a74a8af Mon Sep 17 00:00:00 2001 From: Rohan Yadav Date: Thu, 30 May 2019 11:50:00 -0400 Subject: [PATCH] cleaning up, found root of issue --- pkg/sql/logictest/testdata/logic_test/inet | 5 +++++ pkg/sql/sem/tree/datum.go | 1 - pkg/sql/sem/tree/eval.go | 2 +- pkg/sql/sem/tree/format.go | 2 +- pkg/util/ipaddr/ipaddr.go | 3 --- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/sql/logictest/testdata/logic_test/inet b/pkg/sql/logictest/testdata/logic_test/inet index 7e9a6b8756ba..3eb548312177 100644 --- a/pkg/sql/logictest/testdata/logic_test/inet +++ b/pkg/sql/logictest/testdata/logic_test/inet @@ -27,6 +27,11 @@ SELECT '0.0.0.0':::INET; ---- 0.0.0.0 +query T +SELECT '::/0'::inet::text::inet; +---- +::/0 + # Basic IPv6 tests query T diff --git a/pkg/sql/sem/tree/datum.go b/pkg/sql/sem/tree/datum.go index 481c55592f89..4cc771e272b9 100644 --- a/pkg/sql/sem/tree/datum.go +++ b/pkg/sql/sem/tree/datum.go @@ -1816,7 +1816,6 @@ func MakeDTime(t timeofday.TimeOfDay) *DTime { // ParseDTime parses and returns the *DTime Datum value represented by the // provided string, or an error if parsing is unsuccessful. func ParseDTime(ctx ParseTimeContext, s string) (*DTime, error) { - fmt.Printf("Input time string: %s\n", s) now := relativeParseTime(ctx) t, err := pgdate.ParseTime(now, 0 /* mode */, s) if err != nil { diff --git a/pkg/sql/sem/tree/eval.go b/pkg/sql/sem/tree/eval.go index 4baa1dfda504..1ee2a581d3ee 100644 --- a/pkg/sql/sem/tree/eval.go +++ b/pkg/sql/sem/tree/eval.go @@ -3259,7 +3259,7 @@ func PerformCast(ctx *EvalContext, d Datum, t *types.T) (Datum, error) { case *DUuid: s = t.UUID.String() case *DIPAddr: - s = t.String() + s = AsStringWithFlags(d, FmtBareStrings) case *DString: s = string(*t) case *DCollatedString: diff --git a/pkg/sql/sem/tree/format.go b/pkg/sql/sem/tree/format.go index 55609003ae1c..d7ca57f7b019 100644 --- a/pkg/sql/sem/tree/format.go +++ b/pkg/sql/sem/tree/format.go @@ -387,7 +387,7 @@ func AsStringWithFQNames(n NodeFormatter, ann *Annotations) string { // AsString pretty prints a node to a string. func AsString(n NodeFormatter) string { - return AsStringWithFlags(n, FmtSimple|FmtBareStrings) + return AsStringWithFlags(n, FmtSimple) } // ErrString pretty prints a node to a string. Identifiers are not quoted. diff --git a/pkg/util/ipaddr/ipaddr.go b/pkg/util/ipaddr/ipaddr.go index 222e88036bde..33afd579e3ed 100644 --- a/pkg/util/ipaddr/ipaddr.go +++ b/pkg/util/ipaddr/ipaddr.go @@ -21,7 +21,6 @@ import ( "math" "math/rand" "net" - "runtime/debug" "strconv" "strings" @@ -133,7 +132,6 @@ func (ipAddr IPAddr) String() string { // mask during net.IPNet.String, so we need to add the mask manually. return "::ffff:" + ip.String() + "/" + strconv.Itoa(int(ipAddr.Mask)) } - debug.PrintStack() return ip.String() + "/" + strconv.Itoa(int(ipAddr.Mask)) } @@ -179,7 +177,6 @@ func getFamily(addr string) IPFamily { // examples. func ParseINet(s string, dest *IPAddr) error { var maskSize byte - i := strings.IndexByte(s, '/') family := getFamily(s)