azexcy opened a new issue, #19104:
URL: https://github.com/apache/shardingsphere/issues/19104
## Bug Report
When using Proxy with PostgreSQL, execute `CREATE INDEX IF NOT EXISTS
idx_userid ON t_order ("user_id");`
The first time is success, but execute second time, the error will happen
```
sharding_db=> CREATE INDEX idx_userid ON t_order ("user_id");
CREATE INDEX
sharding_db=> CREATE INDEX IF NOT EXISTS idx_userid ON t_order ("user_id");
ERROR: Index 'idx_userid' already exists.
```
stack:
```
[INFO ] 2022-07-13 18:19:58.956 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: Exception in thread "Thread-22"
org.apache.shardingsphere.infra.exception.ShardingSphereException: Index
'idx_user_id' already exists.
[INFO ] 2022-07-13 18:19:58.956 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.sharding.route.engine.validator.ddl.impl.ShardingCreateIndexStatementValidator.preValidate(ShardingCreateIndexStatementValidator.java:50)
[INFO ] 2022-07-13 18:19:58.956 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.lambda$createRouteContext$0(ShardingSQLRouter.java:53)
[INFO ] 2022-07-13 18:19:58.956 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at java.util.Optional.ifPresent(Optional.java:159)
[INFO ] 2022-07-13 18:19:58.956 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:53)
[INFO ] 2022-07-13 18:19:58.956 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:45)
[INFO ] 2022-07-13 18:19:58.956 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:57)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:53)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:57)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:49)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.createExecutionContext(ShardingSphereStatement.java:472)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.execute0(ShardingSphereStatement.java:426)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.execute(ShardingSphereStatement.java:357)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.data.pipeline.core.prepare.datasource.AbstractDataSourcePreparer.executeTargetTableSQL(AbstractDataSourcePreparer.java:115)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.data.pipeline.postgresql.prepare.datasource.PostgreSQLDataSourcePreparer.prepareTargetTables(PostgreSQLDataSourcePreparer.java:49)
[INFO ] 2022-07-13 18:19:58.957 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobPreparer.prepareTarget(RuleAlteredJobPreparer.java:149)
[INFO ] 2022-07-13 18:19:58.958 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobPreparer.prepareAndCheckTarget(RuleAlteredJobPreparer.java:130)
[INFO ] 2022-07-13 18:19:58.958 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobPreparer.prepareAndCheckTargetWithLock(RuleAlteredJobPreparer.java:110)
[INFO ] 2022-07-13 18:19:58.958 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobPreparer.prepare(RuleAlteredJobPreparer.java:84)
[INFO ] 2022-07-13 18:19:58.958 [docker-java-stream--2104374941]
:Scaling-Proxy - STDOUT: at
org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobScheduler.run(RuleAlteredJobScheduler.java:74)
```
The create table sql
```
CREATE TABLE t_order (order_id INT NOT NULL, user_id INT NOT NULL, status
VARCHAR(45) NULL, PRIMARY KEY (order_id));
```
### Which version of ShardingSphere did you use?
master
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Expected behavior
No error happend, like at Navicat
<img width="760" alt="image"
src="https://user-images.githubusercontent.com/101622833/178709973-cbd6eea9-6b1c-4ce9-ae6c-7bf58d6a9079.png">
### Actual behavior
throw exception
### 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).
--
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]