You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/03/31 15:54:19 UTC

[GitHub] [shardingsphere] PengWangSan opened a new issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

PengWangSan opened a new issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893


   ## Bug Report
   
   
   ### Which version of ShardingSphere did you use?
   5.0.0-RC1-SNAPSHOT
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   The project can startup normally
   ### Actual behavior
   Caused by: org.postgresql.util.PSQLException: permission denied for table t1
   	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
   	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
   	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
   	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
   	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
   	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:322)
   	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308)
   	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284)
   	at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:236)
   	at com.zaxxer.hikari.pool.ProxyStatement.executeQuery(ProxyStatement.java:111)
   	at com.zaxxer.hikari.pool.HikariProxyStatement.executeQuery(HikariProxyStatement.java)
   	at org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaDataLoader.load(ColumnMetaDataLoader.java:75)
   	at org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoader.load(TableMetaDataLoader.java:46)
   	at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:83)
   	at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.loadShardingSchemaMetaData(ShardingMetaDataLoader.java:134)
   	at org.apache.shardingsphere.core.metadata.ShardingMetaDataLoader.load(ShardingMetaDataLoader.java:125)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.loadSchemaMetaData(ShardingRuntimeContext.java:65)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.createMetaData(MultipleDataSourcesRuntimeContext.java:57)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.MultipleDataSourcesRuntimeContext.<init>(MultipleDataSourcesRuntimeContext.java:51)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.<init>(ShardingRuntimeContext.java:49)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingDataSource.<init>(ShardingDataSource.java:54)
   	at org.apache.shardingsphere.shardingjdbc.spring.datasource.SpringShardingDataSource.<init>(SpringShardingDataSource.java:35)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:204)
   	... 17 more
   ### Reason analyze (If you can)
   
   There are table t1,t2 on postgresql. The user has only permission  for table t2. Sharding-jdbc will load all tables by SchemaMetaDataLoader class when it startup. The jdbc driver of postgresql will load table t1 and t2. It will occure PSQLException of  permission denied When ColumnMetaDataLoader class load ColumnMetaData for all tables。The jdbc driver of mysql
   only load table t2. So It needs to filter the tables that user has no permission   when the db is postgresql.
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   There are table t1,t2 on postgresql. The user has only permission  for table t1. It will reproduce  when sharding-jdbc startup.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] cheese8 commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
cheese8 commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-961161520


   I'll try to fix it in PostgreSQLTableMetaDataLoader, please assign it to me, thanks. @terrymanu  @tristaZero 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] dongzl commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
dongzl commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-812275145


   Hi @PengWangSan , welcome, you can submit PR and fix it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-961587949


   @cheese8 Great, welcome to resolve the issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-927287131


   Hi how is it going? @MingxingLAI 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] PengWangSan commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
PengWangSan commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-812013883


   HI @dongzl  ,I think it doesn't matter with the configuration.It is because, the user  don't have the  permission of some tables  on postgresq. My configuration is below. I will fix it .Is OK?
     <bean id="demo_ds" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
           <property name="driverClassName" value="org.postgresql.Driver"/>
           <property name="jdbcUrl" value="jdbc:postgresql://localhost:5432/demo_ds"/>
           <property name="username" value="test"/>
           <property name="password" value="test"/>
       </bean> 
       <bean id="preciseHashCodeShardingAlgorithm" class="org.apache.shardingsphere.example.algorithm.PreciseModuloShardingTableAlgorithm" />    
       
       <sharding:standard-strategy id="tableShardingStrategy" sharding-column="order_id" precise-algorithm-ref="preciseHashCodeShardingAlgorithm" />
       
       <sharding:data-source id="shardingDataSource">
           <sharding:sharding-rule data-source-names="demo_ds" default-data-source-name="demo_ds">
               <sharding:table-rules>
                   <sharding:table-rule logic-table="t_order" actual-data-nodes="demo_ds.t_order_$->{0..1}" table-strategy-ref="tableShardingStrategy"/>
               </sharding:table-rules>
              
           </sharding:sharding-rule>
       </sharding:data-source>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-961587949


   @cheese8 Great, welcome to resolve the issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-890343471


   Sorry, looks like I delayed your progress. Please consider fixing it. Any questions, please ping me. ;-) @MingxingLAI 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-961587949


   @cheese8 Great, welcome to resolve the issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] PengWangSan commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
PengWangSan commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-812873960


   @dongzl HI,I have commited the PR. Please check. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] MingxingLAI commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
MingxingLAI commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-886040324


   Please assign to me. @tristaZero 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] dongzl commented on issue #9893: sharding jdbc startup error when user has no permission of table t1 on postgresql DB.

Posted by GitBox <gi...@apache.org>.
dongzl commented on issue #9893:
URL: https://github.com/apache/shardingsphere/issues/9893#issuecomment-811873015


   Hi @PengWangSan , what's your configuration, can you provide it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org