query := "WITH b(ColA, ColB) AS (VALUES ($1,$2)) UPDATE schema_name.table_name AS a SET ColC = b.ColB FROM b WHERE a.ColA = b.ColA AND a.ColB = b.ColB"
res, err := db.Exec(query, 1, 1)
上面的代码失败并出现以下错误:
pq: operator does not exist: bigint = text
“ColC”是 BIGINT 类型。
根据我的调查,驱动程序将值作为文本而不是整数插入。