You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
diff --git a/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go b/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go
index 492826c21..b109313a9 100644
--- a/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go
+++ b/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go
@@ -78,8 +78,9 @@ func Test_Issue3330(t *testing.T) {
// https://github.com/gogf/gf/issues/3632
func Test_Issue3632(t *testing.T) {
type Member struct {
- One []int64 `json:"one" orm:"one"`
- Two [][]string `json:"two" orm:"two"`
+ One []int64 `json:"one" orm:"one"`
+ Two [][]string `json:"two" orm:"two"`
+ Three []string `json:"tree" orm:"three"`
}
var (
sqlText = gtest.DataContent("issues", "issue3632.sql")
@@ -94,8 +95,9 @@ func Test_Issue3632(t *testing.T) {
var (
dao = db.Model(table)
member = Member{
- One: []int64{1, 2, 3},
- Two: [][]string{{"a", "b"}, {"c", "d"}},
+ One: []int64{1, 2, 3},
+ Two: [][]string{{"a", "b"}, {"c", "d"}},
+ Three: []string{"hello", "中国"},
}
)
diff --git a/contrib/drivers/pgsql/testdata/issues/issue3632.sql b/contrib/drivers/pgsql/testdata/issues/issue3632.sql
index 94897942a..7738d74a5 100644
--- a/contrib/drivers/pgsql/testdata/issues/issue3632.sql
+++ b/contrib/drivers/pgsql/testdata/issues/issue3632.sql
@@ -1,4 +1,5 @@
CREATE TABLE "public"."%s" (
"one" int8[] NOT NULL,
- "two" text[][] NOT NULL
+ "two" text[][] NOT NULL,
+ "three" json not null
);
What did you see happen?
=== RUN Test_Issue3632
INSERT INTO "t_issue3632_1719807582328800552"("one","two","three") VALUES('{1,2,3}','{{"a","b"},{"c","d"}}','{"hello","中国"}') : pq: invalid input syntax for type json
1. INSERT INTO "t_issue3632_1719807582328800552"("one","two","three") VALUES('{1,2,3}','{{"a","b"},{"c","d"}}','{"hello","中国"}')
1). github.com/gogf/gf/v2/database/gdb.(*Core).DoCommit
/opt/repos/go/gf/database/gdb/gdb_core_underlying.go:282
2). github.com/gogf/gf/v2/database/gdb.(*Core).DoExec
/opt/repos/go/gf/database/gdb/gdb_core_underlying.go:139
3). github.com/gogf/gf/contrib/drivers/pgsql/v2.(*Driver).DoExec
/opt/repos/go/gf/contrib/drivers/pgsql/pgsql_do_exec.go:62
4). github.com/gogf/gf/v2/database/gdb.(*Core).DoInsert
/opt/repos/go/gf/database/gdb/gdb_core.go:521
5). github.com/gogf/gf/contrib/drivers/pgsql/v2.(*Driver).DoInsert
/opt/repos/go/gf/contrib/drivers/pgsql/pgsql_do_insert.go:45
6). github.com/gogf/gf/v2/database/gdb.(*DriverWrapperDB).DoInsert
/opt/repos/go/gf/database/gdb/gdb_driver_wrapper_db.go:120
7). github.com/gogf/gf/v2/database/gdb.(*HookInsertInput).Next
/opt/repos/go/gf/database/gdb/gdb_model_hook.go:175
8). github.com/gogf/gf/v2/database/gdb.(*Model).doInsertWithOption
/opt/repos/go/gf/database/gdb/gdb_model_insert.go:333
9). github.com/gogf/gf/v2/database/gdb.(*Model).Insert
/opt/repos/go/gf/database/gdb/gdb_model_insert.go:200
10). command-line-arguments_test.Test_Issue3632.func1
/opt/repos/go/gf/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go:104
11). github.com/gogf/gf/v2/test/gtest.C
/opt/repos/go/gf/test/gtest/gtest_util.go:36
12). command-line-arguments_test.Test_Issue3632
/opt/repos/go/gf/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go:94
2. pq: invalid input syntax for type json
What did you expect to see?
PASS: Test_Issue3632
The text was updated successfully, but these errors were encountered:
tiglog
added
the
bug
It is confirmed a bug, but don't worry, we'll handle it.
label
Jul 1, 2024
Issues-translate-bot
changed the title
contrib/drivers/pgsql: write error with json field
contrib/drivers/pgsql: write error with json field
Jul 1, 2024
Go version
go version go1.21.9 linux/amd64
GoFrame version
2.7.2
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
What did you see happen?
What did you expect to see?
PASS: Test_Issue3632
The text was updated successfully, but these errors were encountered: