Skip to content

Commit

Permalink
Fix CrateDB support (regression in ab9a1af)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixge committed Nov 9, 2017
1 parent f6d3753 commit 4dec986
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,13 @@ where (
t.typtype in('b', 'p', 'r', 'e')
and (base_type.oid is null or base_type.typtype in('b', 'p', 'r'))
)`)
isCrateDB := false
if err != nil {
// Check if CrateDB specific approach might still allow us to connect.
if rows, err = c.crateDBTypesQuery(err); err != nil {
return err
}
isCrateDB = true
}

for rows.Next() {
Expand All @@ -420,6 +422,11 @@ where (
c.ConnInfo = pgtype.NewConnInfo()
c.ConnInfo.InitializeDataTypes(nameOIDs)

if isCrateDB {
// CrateDB does not support enums (initConnInfoEnumArray), so we return
// early here.
return nil
}
return c.initConnInfoEnumArray()
}

Expand Down

0 comments on commit 4dec986

Please sign in to comment.