strongduanmu commented on issue #25343:
URL:
https://github.com/apache/shardingsphere/issues/25343#issuecomment-1730955955
Hi @liming0, I test your sql with master branch, it can run successully. In
addition, I found some errors in the SQL and configuration you provided. The
SQL should write the logical column person_name instead of the plaintext column
person_name_plain. The same goes for configuration files, where incorrect
configuration and SQL writing results in errors.
Below is the modified configuration I provided along with the test SQL,
which performs correctly.
```yaml
databaseName: sharding_db
dataSources:
master:
url: jdbc:postgresql://127.0.0.1:5432/demo_ds_0
username: postgres
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
slave0:
url: jdbc:postgresql://127.0.0.1:5432/demo_ds_0
username: postgres
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
rules:
- !SINGLE
tables:
- "*.*.*"
# 加密策略
- !ENCRYPT
encryptors:
enc-aes:
type: AES
props:
aes-key-value: 123456
enc-md5:
type: MD5
enc-like:
type: CHAR_DIGEST_LIKE
tables:
t_person:
columns:
person_name:
cipher:
name: person_name
encryptorName: enc-aes
assistedQuery:
name: person_name_query
encryptorName: enc-md5
- !READWRITE_SPLITTING
dataSources:
readwrite_ds:
writeDataSourceName: master
readDataSourceNames:
- slave0
loadBalancerName: random
loadBalancers:
random:
type: RANDOM
```
```sql
select tmp.person_id personId,tmp.person_name personName,tmp.contact_text
contactText
from (
select p.person_id,p.person_name,pc.contact_type,pc.contact_text
from t_person p
left join t_person_contacts pc on p.person_id =
pc.person_id
) tmp
where tmp.person_name is not null;
+-------------------+----------+-----------+
|personid |personname|contacttext|
+-------------------+----------+-----------+
|1646797516592115713|顾若萌 |19541831234|
|1646797539849531394|阎丽 |18860174149|
|1646797449030266881|郝建政 |null |
|1646797494655905793|郑建林 |null |
|1646795184307433473|熊林 |null |
+-------------------+----------+-----------+
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]