Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
Expected behavior
When using navicat16 to connect to the shardingproxy's pg database, it is possible to view the table structure
Actual behavior
When using navicat16 to connect to the shardingproxy's pg database and checking the table structure, an error was reported
Reason analyze (If you can)
From the source code, it was found that the SQL sent by navicat is
SELECT t.oid AS oid, (n.nspname)::information_schema.sql_identifier AS trigger_schema, (t.tgname)::information_schema.sql_identifier AS trigger_name, (c.relname)::information_schema.sql_identifier AS trigger_table_name, (em.text)::information_schema.character_data AS event_manipulation, (c.relkind)::information_schema.sql_identifier AS trigger_table_type, (nsp.nspname)::information_schema.sql_identifier AS referenced_table_schema, (cs.relname)::information_schema.sql_identifier AS referenced_table, t.tgdeferrable AS is_deferrable, t.tginitdeferred AS is_deferred, (np.nspname)::information_schema.sql_identifier AS function_schema, (p.proname)::information_schema.sql_identifier AS function_name, ("substring"(pg_get_triggerdef(t.oid), ("position"("substring"(pg_get_triggerdef(t.oid), 48), 'EXECUTE FUNCTION'::text) + 47)))::information_schema.character_data AS action_statement, (CASE WHEN (((t.tgtype)::integer & 1) = 1) THEN 'ROW'::text ELSE 'STATEMENT'::text END)::information_schema.character_data AS for_each, (CASE WHEN (((t.tgtype)::integer & 2) = 2) THEN 'BEFORE'::text ELSE 'AFTER'::text END)::information_schema.character_data AS fire_time, t.tgenabled AS enabled, (CASE WHEN pg_has_role(c.relowner, 'USAGE'::text) THEN (SELECT rm.m[1] AS m FROM regexp_matches(pg_get_triggerdef(t.oid), (E'.{35,} WHEN \((.+)\) EXECUTE FUNCTION'::text)) rm(m) LIMIT 1) ELSE NULL::text END)::information_schema.character_data AS condition, tc.event_object_column AS update_columns, (t.tgconstraint > 0) AS is_constraint, t.tgisinternal AS is_internal, obj_description(t.oid) AS comment FROM pg_trigger t INNER JOIN pg_class c ON t.tgrelid = c.oid LEFT JOIN pg_namespace n ON c.relnamespace = n.oid LEFT JOIN pg_proc p ON t.tgfoid = p.oid LEFT JOIN pg_namespace np ON p.pronamespace = np.oid LEFT JOIN (((SELECT 4, 'INSERT' UNION ALL SELECT 8, 'DELETE') UNION ALL SELECT 16, 'UPDATE') UNION ALL SELECT 32, 'TRUNCATE') em(num, text) ON ((t.tgtype)::integer & em.num) <> 0 LEFT OUTER JOIN (SELECT oid, relnamespace, relname FROM pg_class) cs ON (t.tgconstrrelid = cs.oid) LEFT OUTER JOIN (SELECT oid, nspname FROM pg_namespace) nsp ON (cs.relnamespace = nsp.oid) LEFT JOIN information_schema.triggered_update_columns tc ON (tc.trigger_schema = n.nspname) AND (tc.trigger_name = t.tgname) AND (tc.event_object_schema = n.nspname) AND (tc.event_object_table = c.relname) WHERE (n.nspname)::information_schema.sql_identifier = 'public' AND (c.relname)::information_schema.sql_identifier = 't_db' ORDER BY c.relname, t.tgname ASC
Using jdbc to connect to the proxy, sending the SQL will also result in an error,
The error content is all:
java.lang.NullPointerException: null at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitColumnref(PostgreSQLStatementSQLVisitor.java:504) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitColumnref(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$ColumnrefContext.accept(PostgreSQLStatementParser.java:17288) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:389) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.createProjectionSegment(PostgreSQLStatementSQLVisitor.java:1051) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:1034) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetElContext.accept(PostgreSQLStatementParser.java:8022) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1027) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:958) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SimpleSelectContext.accept(PostgreSQLStatementParser.java:5674) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:926) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectClauseNContext.accept(PostgreSQLStatementParser.java:5509) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:894) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectNoParensContext.accept(PostgreSQLStatementParser.java:5302) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectWithParens(PostgreSQLStatementSQLVisitor.java:920) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectWithParens(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectWithParensContext.accept(PostgreSQLStatementParser.java:5233) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.createSubqueryExpressionSegment(PostgreSQLStatementSQLVisitor.java:419) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:407) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCaseExpr(PostgreSQLStatementSQLVisitor.java:429) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCaseExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CaseExprContext.accept(PostgreSQLStatementParser.java:17050) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:410) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:401) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParserBaseVisitor.visitAExpr(PostgreSQLStatementParserBaseVisitor.java:951) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:315) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.createProjectionSegment(PostgreSQLStatementSQLVisitor.java:1051) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:1034) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetElContext.accept(PostgreSQLStatementParser.java:8022) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1027) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:958) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SimpleSelectContext.accept(PostgreSQLStatementParser.java:5674) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:926) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectClauseNContext.accept(PostgreSQLStatementParser.java:5509) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:894) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectNoParensContext.accept(PostgreSQLStatementParser.java:5302) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelect(PostgreSQLStatementSQLVisitor.java:886) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelect(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectContext.accept(PostgreSQLStatementParser.java:5179) at org.apache.shardingsphere.sql.parser.api.SQLVisitorEngine.visit(SQLVisitorEngine.java:54) at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserExecutor.parse(SQLStatementParserExecutor.java:48) at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:47) at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:58) at org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandlerFactory.newInstance(ProxyBackendHandlerFactory.java:85) at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.simple.PostgreSQLComQueryExecutor.<init>(PostgreSQLComQueryExecutor.java:72) at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecutorFactory.getCommandExecutor(PostgreSQLCommandExecutorFactory.java:106) at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecutorFactory.newInstance(PostgreSQLCommandExecutorFactory.java:71) at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.getCommandExecutor(PostgreSQLCommandExecuteEngine.java:65) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
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).
Which version of ShardingSphere did you use?
5.3.1-SNAPSHOT
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
Expected behavior
When using navicat16 to connect to the shardingproxy's pg database, it is possible to view the table structure
Actual behavior
When using navicat16 to connect to the shardingproxy's pg database and checking the table structure, an error was reported
Reason analyze (If you can)
From the source code, it was found that the SQL sent by navicat is
SELECT t.oid AS oid, (n.nspname)::information_schema.sql_identifier AS trigger_schema, (t.tgname)::information_schema.sql_identifier AS trigger_name, (c.relname)::information_schema.sql_identifier AS trigger_table_name, (em.text)::information_schema.character_data AS event_manipulation, (c.relkind)::information_schema.sql_identifier AS trigger_table_type, (nsp.nspname)::information_schema.sql_identifier AS referenced_table_schema, (cs.relname)::information_schema.sql_identifier AS referenced_table, t.tgdeferrable AS is_deferrable, t.tginitdeferred AS is_deferred, (np.nspname)::information_schema.sql_identifier AS function_schema, (p.proname)::information_schema.sql_identifier AS function_name, ("substring"(pg_get_triggerdef(t.oid), ("position"("substring"(pg_get_triggerdef(t.oid), 48), 'EXECUTE FUNCTION'::text) + 47)))::information_schema.character_data AS action_statement, (CASE WHEN (((t.tgtype)::integer & 1) = 1) THEN 'ROW'::text ELSE 'STATEMENT'::text END)::information_schema.character_data AS for_each, (CASE WHEN (((t.tgtype)::integer & 2) = 2) THEN 'BEFORE'::text ELSE 'AFTER'::text END)::information_schema.character_data AS fire_time, t.tgenabled AS enabled, (CASE WHEN pg_has_role(c.relowner, 'USAGE'::text) THEN (SELECT rm.m[1] AS m FROM regexp_matches(pg_get_triggerdef(t.oid), (E'.{35,} WHEN \((.+)\) EXECUTE FUNCTION'::text)) rm(m) LIMIT 1) ELSE NULL::text END)::information_schema.character_data AS condition, tc.event_object_column AS update_columns, (t.tgconstraint > 0) AS is_constraint, t.tgisinternal AS is_internal, obj_description(t.oid) AS comment FROM pg_trigger t INNER JOIN pg_class c ON t.tgrelid = c.oid LEFT JOIN pg_namespace n ON c.relnamespace = n.oid LEFT JOIN pg_proc p ON t.tgfoid = p.oid LEFT JOIN pg_namespace np ON p.pronamespace = np.oid LEFT JOIN (((SELECT 4, 'INSERT' UNION ALL SELECT 8, 'DELETE') UNION ALL SELECT 16, 'UPDATE') UNION ALL SELECT 32, 'TRUNCATE') em(num, text) ON ((t.tgtype)::integer & em.num) <> 0 LEFT OUTER JOIN (SELECT oid, relnamespace, relname FROM pg_class) cs ON (t.tgconstrrelid = cs.oid) LEFT OUTER JOIN (SELECT oid, nspname FROM pg_namespace) nsp ON (cs.relnamespace = nsp.oid) LEFT JOIN information_schema.triggered_update_columns tc ON (tc.trigger_schema = n.nspname) AND (tc.trigger_name = t.tgname) AND (tc.event_object_schema = n.nspname) AND (tc.event_object_table = c.relname) WHERE (n.nspname)::information_schema.sql_identifier = 'public' AND (c.relname)::information_schema.sql_identifier = 't_db' ORDER BY c.relname, t.tgname ASC
Using jdbc to connect to the proxy, sending the SQL will also result in an error, The error content is all:
java.lang.NullPointerException: null at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitColumnref(PostgreSQLStatementSQLVisitor.java:504) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitColumnref(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$ColumnrefContext.accept(PostgreSQLStatementParser.java:17288) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:389) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.createProjectionSegment(PostgreSQLStatementSQLVisitor.java:1051) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:1034) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetElContext.accept(PostgreSQLStatementParser.java:8022) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1027) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:958) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SimpleSelectContext.accept(PostgreSQLStatementParser.java:5674) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:926) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectClauseNContext.accept(PostgreSQLStatementParser.java:5509) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:894) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectNoParensContext.accept(PostgreSQLStatementParser.java:5302) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectWithParens(PostgreSQLStatementSQLVisitor.java:920) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectWithParens(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectWithParensContext.accept(PostgreSQLStatementParser.java:5233) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.createSubqueryExpressionSegment(PostgreSQLStatementSQLVisitor.java:419) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:407) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCaseExpr(PostgreSQLStatementSQLVisitor.java:429) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCaseExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CaseExprContext.accept(PostgreSQLStatementParser.java:17050) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:410) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:401) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitCExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$CExprContext.accept(PostgreSQLStatementParser.java:16524) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:300) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParserBaseVisitor.visitAExpr(PostgreSQLStatementParserBaseVisitor.java:951) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:315) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitAExpr(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$AExprContext.accept(PostgreSQLStatementParser.java:15446) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.createProjectionSegment(PostgreSQLStatementSQLVisitor.java:1051) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:1034) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetEl(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetElContext.accept(PostgreSQLStatementParser.java:8022) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1027) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:1024) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitTargetList(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$TargetListContext.accept(PostgreSQLStatementParser.java:7941) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:958) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSimpleSelect(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SimpleSelectContext.accept(PostgreSQLStatementParser.java:5674) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:926) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectClauseN(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectClauseNContext.accept(PostgreSQLStatementParser.java:5509) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:894) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelectNoParens(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectNoParensContext.accept(PostgreSQLStatementParser.java:5302) at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelect(PostgreSQLStatementSQLVisitor.java:886) at org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.impl.PostgreSQLStatementSQLVisitor.visitSelect(PostgreSQLStatementSQLVisitor.java:204) at org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser$SelectContext.accept(PostgreSQLStatementParser.java:5179) at org.apache.shardingsphere.sql.parser.api.SQLVisitorEngine.visit(SQLVisitorEngine.java:54) at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserExecutor.parse(SQLStatementParserExecutor.java:48) at org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:47) at org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:58) at org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandlerFactory.newInstance(ProxyBackendHandlerFactory.java:85) at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.simple.PostgreSQLComQueryExecutor.<init>(PostgreSQLComQueryExecutor.java:72) at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecutorFactory.getCommandExecutor(PostgreSQLCommandExecutorFactory.java:106) at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecutorFactory.newInstance(PostgreSQLCommandExecutorFactory.java:71) at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.getCommandExecutor(PostgreSQLCommandExecuteEngine.java:65) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
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).