apache / apache/shardingsphere

\d does not list logical tables correctly in psql client

Open
#25,722 0 comments 0 reactions 0 assignees View on GitHub
db: PostgreSQL in: metadata in: proxy
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 35m
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?
master 955ea40a41f083529ce2b98cd239a16d984ffe4a

### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy with PostgreSQL, Cluster mode , and found the same in Standalone mode

### Expected behavior
Get logical table list

### Actual behavior
I created the sharding rules and tables. When using \d to get the list of tables, I still get the list of physical tables.
image
Only logical tables can be found in the metadata of the governance center
image

### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Cluster mode with:
```yaml
databaseName: sharding_db

dataSources:
ds_0:
url: jdbc:postgresql://127.0.0.1:5432/demo_ds
username: postgres
password: postgres
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
```
execute in psql client
```sql
CREATE SHARDING TABLE RULE t_test (
STORAGE_UNITS(ds_0),
SHARDING_COLUMN=order_id,
TYPE(NAME="hash_mod",PROPERTIES("sharding-count"="4")),
KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME="snowflake"))
);

CREATE TABLE t_test (
order_id int NOT NULL,
user_id int NOT NULL,
status varchar(45) DEFAULT NULL,
PRIMARY KEY (order_id)
);

\d
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in ShardingSphere-Proxy with PostgreSQL using the provided cluster-mode YAML and sharding-table SQL, then run \d in the psql client. Investigate how PostgreSQL metadata is returned for logical and physical tables. Done means \d lists the logical table rather than the physical tables.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.