Skip to content

Commit

Permalink
Merge pull request #896 from lib/revert-890-master
Browse files Browse the repository at this point in the history
Revert "Fix Database Column DATE type parsed as Timestamp when scan into string"
  • Loading branch information
maddyblue committed Sep 19, 2019
2 parents f6da4b5 + 0b68071 commit 931b5ae
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
4 changes: 1 addition & 3 deletions encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,8 @@ func textDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid) interfa
return b
case oid.T_timestamptz:
return parseTs(parameterStatus.currentLocation, string(s))
case oid.T_timestamp:
case oid.T_timestamp, oid.T_date:
return parseTs(nil, string(s))
case oid.T_date:
return string(s)
case oid.T_time:
return mustParse("15:04:05", typ, s)
case oid.T_timetz:
Expand Down
18 changes: 0 additions & 18 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,24 +456,6 @@ func TestByteSliceToText(t *testing.T) {
}
}

func TestDateToString(t *testing.T) {
db := openTestConn(t)
defer db.Close()

value := "2019-08-13"
row := db.QueryRow("SELECT $1::Date", value)

var result string
err := row.Scan(&result)
if err != nil {
t.Fatal(err)
}

if result != value {
t.Fatalf("expected %v but got %v", value, result)
}
}

func TestStringToBytea(t *testing.T) {
db := openTestConn(t)
defer db.Close()
Expand Down

0 comments on commit 931b5ae

Please sign in to comment.