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 2019/05/31 11:03:30 UTC

[GitHub] [incubator-shardingsphere] wowojyc opened a new issue #2480: ShardingDataSource wrapped with EncryptDataSource for PostgreSQL

wowojyc opened a new issue #2480: ShardingDataSource wrapped with EncryptDataSource for PostgreSQL
URL: https://github.com/apache/incubator-shardingsphere/issues/2480
 
 
   ## Bug Report
   In my project, My database type is postgreSQL, and I want to use ShardingDatasource with encrypt configuration.
   
   For example, the encrypt column is "goods_name" and the assist column is "goods_name_new", but it does not work.
   
   When i debug the code, i find the code below.
   
   `public Optional<ShardingEncryptor> getShardingEncryptor(final String logicTableName, final String columnName) {
           for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
               Optional<ShardingEncryptor> result = each.getShardingEncryptor(logicTableName, columnName);
               if (result.isPresent()) {
                   return result;
               }
           }
           return Optional.absent();
       }`
   The sharding jdbc rewrites the sql with column alias, for example
   
   select goods0_.goods_id as goods_id1_0_, goods0_.goods_name as goods_na2_0_, goods0_.goods_type as goods_ty3_0_ from goods goods0_
   
   So when it comes to the code before, the table name is right, however the column is alias name.
   
   I think it is due to PostgreSQL PgResultSet.class. Its attributes 'fields' is set according to  alias value rather than querying its from the PostgreSQL meta.
   
   My PostgreSQL is 10.1
   the sharding jdbc version is 4.0.0-RC1
   
   Thank you very much!
   

----------------------------------------------------------------
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


With regards,
Apache Git Services