2
0

pgtype.OID type should only be used for scanning and encoding values

It was a mistake to use it in other contexts. This made interop
difficult between pacakges that depended on pgtype such as pgx and
packages that did not like pgconn and pgproto3. In particular this was
awkward for prepared statements.

This is preparation for removing pgx.PreparedStatement in favor of
pgconn.PreparedStatement.
This commit is contained in:
Jack Christensen
2019-08-24 13:55:57 -05:00
parent 7385349950
commit 6972a57421
14 changed files with 80 additions and 49 deletions
+1 -1
View File
@@ -312,7 +312,7 @@ func (r *Rows) Columns() []string {
// ColumnTypeDatabaseTypeName return the database system type name.
func (r *Rows) ColumnTypeDatabaseTypeName(index int) string {
if dt, ok := r.conn.conn.ConnInfo.DataTypeForOID(pgtype.OID(r.rows.FieldDescriptions()[index].DataTypeOID)); ok {
if dt, ok := r.conn.conn.ConnInfo.DataTypeForOID(uint32(r.rows.FieldDescriptions()[index].DataTypeOID)); ok {
return strings.ToUpper(dt.Name)
}