我創建了一個帶有 BYTEA 字段的簡單 sql 數據庫,create table testhex (testhex bytea);insert into testhex (testhex) values ('\x123456');然后我嘗試從 Go 查詢它。package main import ( "database/sql" _ "github.com/lib/pq" ) func main(){ var err error db, err := sql.Open("postgres", "dbname=testhex sslmode=disable") if err != nil { panic(err) } var result string err = db.QueryRow("select testhex from testhex where testhex = $1", `\x123456`).Scan(&result) if err != nil { panic(err) } }它沒有找到該行。我究竟做錯了什么?
- 1 回答
- 0 關注
- 169 瀏覽
添加回答
舉報
0/150
提交
取消