diff --git a/hbrtl_ext/pgrtl/pg.go b/hbrtl_ext/pgrtl/pg.go index bf10d8a..ae2fa87 100644 --- a/hbrtl_ext/pgrtl/pg.go +++ b/hbrtl_ext/pgrtl/pg.go @@ -28,6 +28,7 @@ package pgrtl import ( "context" + "encoding/json" "fmt" "strings" "sync" @@ -283,6 +284,12 @@ func goToHbValue(g interface{}) hbrt.Value { return hbrt.MakeDouble(v, 0, 0) case time.Time: return hbrt.MakeString(v.Format(time.RFC3339)) + case map[string]interface{}, []interface{}: + // jsonb/json columns arrive as decoded maps/slices — render as JSON + // text (matches the `col::text` read convention; callers hb_jsonDecode). + if b, err := json.Marshal(v); err == nil { + return hbrt.MakeString(string(b)) + } } return hbrt.MakeString(fmt.Sprintf("%v", g)) }