apache / apache/shardingsphere

Column "TODO" not found exception occurs when I run integration test with jdbc, Standalone, PostgreSQL and encrypt param

Open
#23,626 5 comments 0 reactions 0 assignees View on GitHub
in: JDBC type: bug
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 35m
Merged PRs (30d)
326

Description

## Bug Report

### Which version of ShardingSphere did you use?

[f52f484](https://github.com/apache/shardingsphere/commit/f52f4846ce4cdce734dd79dcad1f94e1c50d408d)

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

ShardingSphere-JDBC

### Expected behavior

Execute `INSERT INTO t_user (user_id, user_name_cipher, user_name_like, user_name_plain, password_cipher, email_cipher, telephone_cipher, telephone_like, telephone_plain, creation_date) VALUES (?, ?, ?, ?, 'MyOShk4kjRnds7CZfU5NCw==', 'VvWKtMDr5+58OMAAu6BH5A==', '8Rj1Bg696vJMKwPNxzxGOg==', '01450145014', '12341234123', '2018-08-08'), (?, ?, ?, ?, 'qbUuBn0oxdrV8sNNyoqDCg==', 'FRo1h44oclER1+0MeI1T0w==', 'cD36lxxtVApK4QLzec87zg==', '14541454545', '23452345456', '2019-08-08')` successfully with JDBC executeUpdateForPreparedStatementWithColumnNames interface

### Actual behavior

```text
Error: assertExecuteUpdateWithColumnNames[jdbc: encrypt -> H2 -> Placeholder -> INSERT INTO t_user {user_id, user_name, password, email, telephone, creation_date} VALUES {?, ?, '123456', 'tomas@gmail.com', '12341234123', '2018-08-08'}, {?, ?, '23456', 'mike@qq.com', '23452345456', '2019-08-08'}] Time elapsed: 0.013 s <<< ERROR!
org.h2.jdbc.JdbcSQLSyntaxErrorException:
Column "TODO" not found; SQL statement:
INSERT INTO t_user (user_id, user_name_cipher, user_name_like, user_name_plain, password_cipher, email_cipher, telephone_cipher, telephone_like, telephone_plain, creation_date) VALUES (?, ?, ?, ?, 'MyOShk4kjRnds7CZfU5NCw==', 'VvWKtMDr5+58OMAAu6BH5A==', '8Rj1Bg696vJMKwPNxzxGOg==', '01450145014', '12341234123', '2018-08-08'), (?, ?, ?, ?, 'qbUuBn0oxdrV8sNNyoqDCg==', 'FRo1h44oclER1+0MeI1T0w==', 'cD36lxxtVApK4QLzec87zg==', '14541454545', '23452345456', '2019-08-08') [42122-214]
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.executeUpdateForPreparedStatementWithColumnNames(AdditionalDMLE2EIT.java:143)
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.assertExecuteUpdateWithColumnNames(AdditionalDMLE2EIT.java:127)

Error: assertExecuteWithColumnNames[jdbc: encrypt -> H2 -> Literal -> UPDATE t_user u SET u.password = ? WHERE u.user_id = ?] Time elapsed: 0.014 s <<< ERROR!
org.h2.jdbc.JdbcSQLSyntaxErrorException:
Column "TODO" not found; SQL statement:
UPDATE t_user u SET password_cipher = 'wuhmEKgdgrWQYt+Ev0hgGA==' WHERE u.user_id = 10 [42122-214]
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.executeForStatementWithColumnNames(AdditionalDMLE2EIT.java:252)
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.assertExecuteWithColumnNames(AdditionalDMLE2EIT.java:245)

Error: assertExecuteWithColumnNames[jdbc: encrypt -> H2 -> Placeholder -> UPDATE t_user u SET u.password = ? WHERE u.user_id = ?] Time elapsed: 0.016 s <<< ERROR!
org.h2.jdbc.JdbcSQLSyntaxErrorException:
Column "TODO" not found; SQL statement:
UPDATE t_user u SET password_cipher = ? WHERE u.user_id = ? [42122-214]
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.executeForPreparedStatementWithColumnNames(AdditionalDMLE2EIT.java:262)
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.assertExecuteWithColumnNames(AdditionalDMLE2EIT.java:245)

Error: assertExecuteUpdateWithColumnNames[jdbc: encrypt -> H2 -> Placeholder -> UPDATE t_user u SET u.password = ? WHERE u.user_id = ?] Time elapsed: 0.014 s <<< ERROR!
org.h2.jdbc.JdbcSQLSyntaxErrorException:
Column "TODO" not found; SQL statement:
UPDATE t_user u SET password_cipher = ? WHERE u.user_id = ? [42122-214]
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.executeUpdateForPreparedStatementWithColumnNames(AdditionalDMLE2EIT.java:143)
at org.apache.shardingsphere.test.e2e.engine.dml.AdditionalDMLE2EIT.assertExecuteUpdateWithColumnNames(AdditionalDMLE2EIT.java:127)
```

### Reason analyze (If you can)

### 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).

Contributor guide

Open the contributing guide

Research direction

Start with the failing cases in test/e2e/engine/dml/AdditionalDMLE2EIT.java, especially executeUpdateForPreparedStatementWithColumnNames at line 143 and the column-name execution methods around lines 245-262. Run the JDBC encrypt integration tests and trace the generated SQL that causes H2 to report column "TODO"; done means the listed INSERT and UPDATE cases pass without that exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
databases, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.