apache / apache/shardingsphere

panic: pq: No value specified for parameter 1. when using Golang XORM

Open
#22,501 2 comments 0 reactions 0 assignees View on GitHub
db: PostgreSQL in: proxy type: bug
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 35m
Merged PRs (30d)
326

Description

## Bug Report

### Which version of ShardingSphere did you use?

master - e71e94d7e1b71694402829ea0074cb085129069e

This issue may be caused by https://github.com/apache/shardingsphere/pull/13692

### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy PostgreSQL

### Expected behavior

Query returned correct result.

### Actual behavior

```
panic: pq: No value specified for parameter 1.
```

### Reason analyze (If you can)

![image](https://user-images.githubusercontent.com/20503072/204470841-e9ae17c9-bb8c-4d90-8489-8d0cbead962b.png)

![image](https://user-images.githubusercontent.com/20503072/204470888-7b2d807b-7657-4cd2-a44e-41082e5a36dd.png)

### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

```yaml
schemaName: postgres
dataSources:
ds_0:
url: jdbc:postgresql://127.0.0.1:5432/postgres?prepareThreshold=1
username: postgres
password: postgres
connectionTimeoutMilliseconds: 3000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 32
minPoolSize: 0

rules: []
```

### Reproduce

```
docker run \
--network host \
-e driverName=postgres \
-e dataSourceName='user=postgres password=postgres host=127.0.0.1 port=55432 sslmode=disable dbname=casdoor' \
casbin/casdoor:v1.171.0
```

```
panic: pq: No value specified for parameter 1.

goroutine 1 [running]:
github.com/casdoor/casdoor/object.(*Adapter).createTable(0xc0000b4ec0)
/go/src/casdoor/object/adapter.go:128 +0x8ce
github.com/casdoor/casdoor/object.InitAdapter(0x0)
/go/src/casdoor/object/adapter.go:53 +0xb1
main.main()
/go/src/casdoor/main.go:38 +0xa7
```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied ShardingSphere-Proxy PostgreSQL configuration and Casdoor Docker reproduction, using the stack trace at casdoor/object/adapter.go:128 as the client-side entry point while tracing prepared-parameter handling in the proxy. Done means the reproduction no longer panics and the query returns the correct result.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, java, postgresql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.