generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Returning JSON into JSON.RawMessage reports the following error:
===Error:
2025/10/23 01:11:00 /scratch/shulili/GORM/gorm-github/gorm-oracle/tests/json_edge_cases_test.go:189 sql: Scan error on column index 1, name "doc": unsupported Scan, storing driver.Value type godror.JSON into type *json.RawMessage
[1.007ms] [rows:1] SELECT * FROM "returning_records" WHERE "record_id" = 1
json_edge_cases_test.go:190: returning into RawMessage failed: sql: Scan error on column index 1, name "doc": unsupported Scan, storing driver.Value type godror.JSON into type *json.RawMessage
===Code snapshot:
type ReturnedRaw struct{ Doc json.RawMessage }
var retRaw ReturnedRaw
if err := DB.
Clauses(clause.Returning{Columns: []clause.Column{{Name: "doc"}}}).
Model(&ReturningRecord{}).
Where(`"record_id" = ?`, record.ID).
Update("doc", gorm.Expr(`JSON_TRANSFORM("doc", SET '$.n' = 3)`)).
Scan(&retRaw).Error; err != nil {
t.Fatalf("returning into RawMessage failed: %v", err)
}
===Full test case can be found in json_bulk_2_test.go(TestJSONReturning)
Metadata
Metadata
Assignees
Labels
No labels