apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
20.02k stars 6.77k forks source link

Table cannot be prefixed with pg_ in ShardingSphere-Proxy PostgreSQL/openGauss #22341

Open TeslaCN opened 2 years ago

TeslaCN commented 2 years ago

Bug Report

Which version of ShardingSphere did you use?

d9798c3c6480ab5434c65b0e726aca72830d140d

This issue is caused by #13692. So this impact ShardingSphere-Proxy >= 5.1.0

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

ShardingSphere-Proxy PostgreSQL/openGauss

Expected behavior

DML operations without error.

Actual behavior

postgres=> create table pg_mytable ();
CREATE TABLE
postgres=> select * from pg_mytable;
ERROR:  relation "pg_mytable" does not exist
LINE 1: select * from pg_mytable;
                      ^
[INFO ] 2022-11-22 17:44:46.210 [Connection-2-ThreadExecutor] o.a.s.p.b.h.a.e.AbstractDatabaseMetadataExecutor$DefaultDatabaseMetadataExecutor - Actual SQL: ds_0 ::: select * from pg_mytable;
[ERROR] 2022-11-22 17:44:46.225 [Connection-2-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
org.postgresql.util.PSQLException: ERROR: relation "pg_mytable" does not exist
  Position: 15
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:181)
    at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:133)
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
    at org.apache.shardingsphere.proxy.backend.handler.admin.executor.AbstractDatabaseMetadataExecutor$DefaultDatabaseMetadataExecutor.getSourceData(AbstractDatabaseMetadataExecutor.java:216)
    at org.apache.shardingsphere.proxy.backend.handler.admin.executor.AbstractDatabaseMetadataExecutor.execute(AbstractDatabaseMetadataExecutor.java:76)
    at org.apache.shardingsphere.proxy.backend.handler.admin.DatabaseAdminQueryBackendHandler.execute(DatabaseAdminQueryBackendHandler.java:56)
    at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.simple.PostgreSQLComQueryExecutor.execute(PostgreSQLComQueryExecutor.java:76)
    at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111)
    at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
TeslaCN commented 2 years ago

Hi @tuichenchuxin Maybe what you have done recently could fix this issue?

tuichenchuxin commented 2 years ago

Yes, it should be solved by simulating the table, the empty table is easy to simulate, but the data collection and simulation need some additional development