dissdic commented on issue #15134:
URL: 
https://github.com/apache/shardingsphere/issues/15134#issuecomment-1195254033

   for some reason,the format in the view got messed up.
   **here is the stacktrace info I got :**
   ```
   Caused by: org.springframework.jdbc.BadSqlGrammarException: 
PreparedStatementCallback; bad SQL grammar [SELECT kkk.id as id,kkk.name as 
name,kkk.domain_name as domain_name,kkk."version" as "version",kkk.insert_user 
as insert_user,kkk.insert_date as insert_date,kkk.update_user as 
update_user,kkk.update_date as update_date FROM wms_kkk as kkk  WHERE kkk.id = 
? ]; nested exception is org.postgresql.util.PSQLException: 错误: 操作符不存在: bigint 
= character varying
     建议:没有匹配指定名称和参数类型的操作符. 您也许需要增加明确的类型转换.
     位置:256
   at 
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
   at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
   at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
   at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
   at 
logwire.web.service.query.sql.jdbc.JdbcTemplateUtil.translateException(JdbcTemplateUtil.java:79)
   at 
logwire.web.service.query.sql.jdbc.JdbcTemplateUtil.execute(JdbcTemplateUtil.java:61)
   at 
logwire.web.service.query.sql.DynamicSqlSelect.doSelect(DynamicSqlSelect.java:733)
   at 
logwire.web.service.query.sql.DynamicSqlSelect.doSelect(DynamicSqlSelect.java:660)
   at 
logwire.web.service.query.sql.DynamicSqlSelect.forIterator(DynamicSqlSelect.java:443)
   at 
logwire.web.service.query.sql.DynamicSqlSelect.getSingleRow(DynamicSqlSelect.java:601)
   ... 54 common frames omitted
   Caused by: org.postgresql.util.PSQLException: 错误: 操作符不存在: bigint = character 
varying
     建议:没有匹配指定名称和参数类型的操作符. 您也许需要增加明确的类型转换.
     位置:256
   at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2468)
   at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2211)
   at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:309)
   at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446)
   at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370)
   at 
org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:149)
   at 
org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:108)
   at 
com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
   at 
com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
   at 
org.apache.shardingsphere.driver.executor.callback.impl.PreparedStatementExecuteQueryCallback.executeQuery(PreparedStatementExecuteQueryCallback.java:40)
   at 
org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback.executeSQL(ExecuteQueryCallback.java:44)
   at 
org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback.executeSQL(ExecuteQueryCallback.java:36)
   at 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
   at 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
   at 
org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:101)
   at 
org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.serialExecute(ExecutorEngine.java:87)
   at 
org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:81)
   at 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:65)
   at 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:49)
   at 
org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.executeQuery(DriverJDBCExecutor.java:73)
   at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeQuery0(ShardingSpherePreparedStatement.java:212)
   at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeQuery(ShardingSpherePreparedStatement.java:181)
   at 
logwire.web.service.query.sql.DynamicSqlSelect.lambda$doSelect$15(DynamicSqlSelect.java:725)
   at 
logwire.web.service.query.sql.jdbc.JdbcTemplateUtil.execute(JdbcTemplateUtil.java:46)
   ... 58 common frames omitted
   ```
   for setting values in to a SQL,we used the setValues(PreparedStatement ps) 
in PreparedStatementSetter,as you can see in the image below:
   
   
![image](https://user-images.githubusercontent.com/42462093/180973912-d5499409-7b79-4f4b-bf7b-de03a172d483.png)
   
   **and the implementation of this abstract method is like this:**
   
   
![image](https://user-images.githubusercontent.com/42462093/180974190-c99be6e7-adcb-437b-8a2a-1a7510abf34a.png)
   
   **and the code of the another setValue method present in the sceenshot is:**
   
   
![image](https://user-images.githubusercontent.com/42462093/180974462-cc75b4ae-7a6f-4793-84c6-ab3fca459c5f.png)
   
   
![image](https://user-images.githubusercontent.com/42462093/180974646-df6c54e8-7239-4039-ad65-55f6bd166629.png)
   
   the core code is:
   > field.setValueIgnoreCheck(ps, index + 1, values.get(i), this.dialect);
   
   which present as:
   
   
![image](https://user-images.githubusercontent.com/42462093/180974877-d9b7a838-86b2-4ce9-8c81-07c835d097fa.png)
   
   the code of the method setValueInPreparedStatement shown in the sceenshot is:
   
   
![image](https://user-images.githubusercontent.com/42462093/180975084-fd53ffc3-83e5-42be-8996-389537f8de00.png)
   
   despite these execution processes,I got the explicit detail info of this 
method while debugging:
   
   
![image](https://user-images.githubusercontent.com/42462093/180975265-cbd0295b-6c36-4d9d-95f0-b7cc5717a7d1.png)
   
   this shows that eventually the setValue of ShardingSpherePreparedStatement 
was invoked.and I got the Exception written in the beginning.
   


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

Reply via email to