apache / apache/shardingsphere

Select from table through ShardingSphere not working through asyncpg

Open
#23,965 7 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 38m
Merged PRs (30d)
326

Description

## Bug Report

**For English only**, other languages will not accept.

Before report a bug, make sure you have:

- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.

Please answer these questions before submitting your issue. Thanks!

### Which version of ShardingSphere did you use?
ShardingSphere Proxy 5.3.2
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere- Proxy
### Expected behavior
Select from tables through ShardingSphere should work. When we replace the database connection parameters with a direct postgres database then we are able to do a select on table.
### Actual behavior
Select from tables through ShardingSphere are not working.
The issue is mentioned below:-
`asyncpg.exceptions._base.InternalClientError: cannot switch to state 12; another operation (2) is in progress
`
### Reason analyze (If you can)

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

### Example codes for reproduce this issue (such as a github link).
```
import asyncio
import asyncpg

async def run():
conn = await asyncpg.connect(user='root', password='root',
database='hint_db', host='127.0.0.1', port=3307)
values = await conn.fetchval(
'SELECT * FROM tracking_info;'
)
print(values)
await conn.close()

loop = asyncio.get_event_loop()
task = loop.create_task(run())
loop.run_until_complete(task)
```

Contributor guide

Open the contributing guide

Research direction

Start with the provided asyncpg reproduction script and the ShardingSphere Proxy 5.3.2 setup, comparing its SELECT behavior with the direct PostgreSQL connection described in the issue. A complete fix should allow the table query to succeed through the proxy without the asyncpg “another operation is in progress” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql, python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.