penghuazhou opened a new issue, #37993:
URL: https://github.com/apache/shardingsphere/issues/37993
## Feature Request
support interpolateParams=false.
### Describe the feature you would like.
if use
"sharding:sharding@tcp(192.168.12.213:23307)/sharding_db?charset=utf8mb4&parseTime=True&loc=Local&interpolateParams=false",
it will throw error below, if "interpolateParams=true", it will success.
```
zego@192 claude-flow-demo % go run sharding.go
2026/02/09 16:42:31 /Users/zego/workspace/claude-flow-demo/sharding.go:29
Error 20024 (44000): Sharding value '[B@78a67186' must implements Comparable.
[12.818ms] [rows:-] SELECT deleted_at FROM tbl_group WHERE app_id = 0 AND
group_id = '0' AND deleted_at > 0 LIMIT 1
2026/02/09 16:42:31 Query failed: Error 20024 (44000): Sharding value
'[B@78a67186' must implements Comparable.
```
go client
```
package main
import (
"fmt"
"log"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
func main() {
// Database connection
dsn :=
"sharding:sharding@tcp(192.168.12.213:23307)/sharding_db?charset=utf8mb4&parseTime=True&loc=Local&interpolateParams=false"
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{
Logger: logger.Default.LogMode(logger.Info),
})
if err != nil {
log.Fatalf("Failed to connect: %v", err)
}
// Simple query
var result []struct {
DeletedAt int64 `gorm:"column:deleted_at"`
}
rawSQL := "SELECT deleted_at FROM tbl_group WHERE app_id = ? AND
group_id = ? AND deleted_at > 0 LIMIT 1"
err = db.Raw(rawSQL, int64(0), "0").Scan(&result).Error
if err != nil {
log.Fatalf("Query failed: %v", err)
}
fmt.Printf("✅ Query succeeded, results: %+v\n", result)
}
```
database-sharding.yaml
```
databaseName: sharding_db
dataSources:
ds_0:
url:
jdbc:mysql://127.0.0.1:3306/sharding?serverTimezone=UTC&useSSL=false&charset=utf8mb4&parseTime=True&allowPublicKeyRetrieval=true
username: sharding
password: sharding
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 500
minPoolSize: 10
customPoolProps:
leakDetectionThreshold: 30000
registerMbeans: true
rules:
- !SHARDING
tables:
tbl_group:
actualDataNodes: ds_0.tbl_group_${0}_${0}
tableStrategy:
complex:
shardingColumns: app_id,group_id
shardingAlgorithmName: tbl_group_strategy
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
defaultKeyGenerateStrategy:
keyGeneratorName: snowflake
column: id
shardingAlgorithms:
tbl_group_strategy:
type: COMPLEX_INLINE
props:
algorithm-expression:
tbl_group_${app_id}_${Math.abs(group_id.hashCode()) % 2}
keyGenerators:
snowflake:
type: SNOWFLAKE
props:
worker-id: 561
```
create table
```
CREATE TABLE `tbl_group` (
`app_id` bigint NOT NULL COMMENT '应用ID',
`group_id` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '群组ID',
`deleted_at` bigint NOT NULL DEFAULT '0' COMMENT '删除时间(毫秒时间戳,0表示未删除)'
) ENGINE=InnoDB AUTO_INCREMENT=435 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_unicode_ci;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]