2
0

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.

Because pgx depends on pgtype and the tests for pgtype depend on pgx
this change will require a couple back and forth commits to get the
go.mod dependecies correct.
This commit is contained in:
Jack Christensen
2019-08-24 13:49:12 -05:00
parent 4cf1c44817
commit ab885b375b
8 changed files with 55 additions and 24 deletions
+3 -3
View File
@@ -225,12 +225,12 @@ func TestPgxSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFun
for i, tt := range tests {
for _, fc := range formats {
psName := fmt.Sprintf("test%d", i)
ps, err := conn.Prepare(context.Background(), psName, tt.SQL)
_, err := conn.Prepare(context.Background(), psName, tt.SQL)
if err != nil {
t.Fatal(err)
}
ps.FieldDescriptions[0].FormatCode = fc.formatCode
queryResultFormats := pgx.QueryResultFormats{fc.formatCode}
if ForceEncoder(tt.Value, fc.formatCode) == nil {
t.Logf("Skipping: %#v does not implement %v", tt.Value, fc.name)
continue
@@ -243,7 +243,7 @@ func TestPgxSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFun
}
result := reflect.New(reflect.TypeOf(derefV))
err = conn.QueryRow(context.Background(), psName).Scan(result.Interface())
err = conn.QueryRow(context.Background(), psName, queryResultFormats).Scan(result.Interface())
if err != nil {
t.Errorf("%v %d: %v", fc.name, i, err)
}