RaigorJiang commented on issue #18434:
URL: 
https://github.com/apache/shardingsphere/issues/18434#issuecomment-1189845077

   @wsm12138 
   After verification, I found that the reason was that the routing results did 
not meet expectations when creating table, so the preview query got that result.
   
   #### sql_parser rule
   ```sql
   postgres=> SHOW SQL_PARSER RULE;
    sql_comment_parse_enable |              parse_tree_cache              |     
        sql_statement_cache
   
--------------------------+--------------------------------------------+----------------------------------------------
    true                     | {"initialCapacity":128,"maximumSize":1024} | 
{"initialCapacity":2000,"maximumSize":65535}
   (1 row)
   ```
   
   #### routing of create table
   ```
   [INFO ] 2022-07-20 13:22:14.462 [Connection-2-ThreadExecutor] 
ShardingSphere-SQL - Logic SQL: /* ShardingSphere hint: dataSourceName=ds_0 */ 
CREATE TABLE g(id int, name char);
   [INFO ] 2022-07-20 13:22:14.462 [Connection-2-ThreadExecutor] 
ShardingSphere-SQL - SQLStatement: 
PostgreSQLCreateTableStatement(super=CreateTableStatement(super=AbstractSQLStatement(parameterCount=0,
 parameterMarkerSegments=[], commentSegments=[CommentSegment(text=/* 
ShardingSphere hint: dataSourceName=ds_0 */, startIndex=0, stopIndex=45)]), 
table=SimpleTableSegment(tableName=TableNameSegment(startIndex=60, 
stopIndex=60, identifier=IdentifierValue(value=g, quoteCharacter=NONE)), 
owner=Optional.empty, alias=Optional.empty), 
columnDefinitions=[ColumnDefinitionSegment(startIndex=62, stopIndex=67, 
columnName=ColumnSegment(startIndex=62, stopIndex=63, 
identifier=IdentifierValue(value=id, quoteCharacter=NONE), 
owner=Optional.empty), dataType=DataTypeSegment(startIndex=65, stopIndex=67, 
dataTypeName=int, dataLength=null), primaryKey=false, notNull=false, 
referencedTables=[]), ColumnDefinitionSegment(startIndex=70, stopIndex=78, 
columnName=ColumnSegment(startIndex=70, stopIndex=73, identi
 fier=IdentifierValue(value=name, quoteCharacter=NONE), owner=Optional.empty), 
dataType=DataTypeSegment(startIndex=75, stopIndex=78, dataTypeName=char, 
dataLength=null), primaryKey=false, notNull=false, referencedTables=[])], 
constraintDefinitions=[]), ifNotExists=false)
   [INFO ] 2022-07-20 13:22:14.462 [Connection-2-ThreadExecutor] 
ShardingSphere-SQL - Actual SQL: ds_1 ::: /* ShardingSphere hint: 
dataSourceName=ds_0 */ CREATE TABLE g(id int, name char);
   ```
   
   


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