github.com/team-ide/go-dialect@v1.9.20/vitess/sqlparser/ast_rewrite.go (about)

     1  /*
     2  Copyright 2021 The Vitess Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  // Code generated by ASTHelperGen. DO NOT EDIT.
    17  
    18  package sqlparser
    19  
    20  func (a *application) rewriteSQLNode(parent SQLNode, node SQLNode, replacer replacerFunc) bool {
    21  	if node == nil {
    22  		return true
    23  	}
    24  	switch node := node.(type) {
    25  	case AccessMode:
    26  		return a.rewriteAccessMode(parent, node, replacer)
    27  	case *AddColumns:
    28  		return a.rewriteRefOfAddColumns(parent, node, replacer)
    29  	case *AddConstraintDefinition:
    30  		return a.rewriteRefOfAddConstraintDefinition(parent, node, replacer)
    31  	case *AddIndexDefinition:
    32  		return a.rewriteRefOfAddIndexDefinition(parent, node, replacer)
    33  	case AlgorithmValue:
    34  		return a.rewriteAlgorithmValue(parent, node, replacer)
    35  	case *AliasedExpr:
    36  		return a.rewriteRefOfAliasedExpr(parent, node, replacer)
    37  	case *AliasedTableExpr:
    38  		return a.rewriteRefOfAliasedTableExpr(parent, node, replacer)
    39  	case *AlterCharset:
    40  		return a.rewriteRefOfAlterCharset(parent, node, replacer)
    41  	case *AlterColumn:
    42  		return a.rewriteRefOfAlterColumn(parent, node, replacer)
    43  	case *AlterDatabase:
    44  		return a.rewriteRefOfAlterDatabase(parent, node, replacer)
    45  	case *AlterMigration:
    46  		return a.rewriteRefOfAlterMigration(parent, node, replacer)
    47  	case *AlterTable:
    48  		return a.rewriteRefOfAlterTable(parent, node, replacer)
    49  	case *AlterView:
    50  		return a.rewriteRefOfAlterView(parent, node, replacer)
    51  	case *AlterVschema:
    52  		return a.rewriteRefOfAlterVschema(parent, node, replacer)
    53  	case *AndExpr:
    54  		return a.rewriteRefOfAndExpr(parent, node, replacer)
    55  	case Argument:
    56  		return a.rewriteArgument(parent, node, replacer)
    57  	case *AutoIncSpec:
    58  		return a.rewriteRefOfAutoIncSpec(parent, node, replacer)
    59  	case *Begin:
    60  		return a.rewriteRefOfBegin(parent, node, replacer)
    61  	case *BetweenExpr:
    62  		return a.rewriteRefOfBetweenExpr(parent, node, replacer)
    63  	case *BinaryExpr:
    64  		return a.rewriteRefOfBinaryExpr(parent, node, replacer)
    65  	case BoolVal:
    66  		return a.rewriteBoolVal(parent, node, replacer)
    67  	case *CallProc:
    68  		return a.rewriteRefOfCallProc(parent, node, replacer)
    69  	case *CaseExpr:
    70  		return a.rewriteRefOfCaseExpr(parent, node, replacer)
    71  	case *ChangeColumn:
    72  		return a.rewriteRefOfChangeColumn(parent, node, replacer)
    73  	case *CheckConstraintDefinition:
    74  		return a.rewriteRefOfCheckConstraintDefinition(parent, node, replacer)
    75  	case ColIdent:
    76  		return a.rewriteColIdent(parent, node, replacer)
    77  	case *ColName:
    78  		return a.rewriteRefOfColName(parent, node, replacer)
    79  	case *CollateExpr:
    80  		return a.rewriteRefOfCollateExpr(parent, node, replacer)
    81  	case *ColumnDefinition:
    82  		return a.rewriteRefOfColumnDefinition(parent, node, replacer)
    83  	case *ColumnType:
    84  		return a.rewriteRefOfColumnType(parent, node, replacer)
    85  	case Columns:
    86  		return a.rewriteColumns(parent, node, replacer)
    87  	case Comments:
    88  		return a.rewriteComments(parent, node, replacer)
    89  	case *Commit:
    90  		return a.rewriteRefOfCommit(parent, node, replacer)
    91  	case *CommonTableExpr:
    92  		return a.rewriteRefOfCommonTableExpr(parent, node, replacer)
    93  	case *ComparisonExpr:
    94  		return a.rewriteRefOfComparisonExpr(parent, node, replacer)
    95  	case *ConstraintDefinition:
    96  		return a.rewriteRefOfConstraintDefinition(parent, node, replacer)
    97  	case *ConvertExpr:
    98  		return a.rewriteRefOfConvertExpr(parent, node, replacer)
    99  	case *ConvertType:
   100  		return a.rewriteRefOfConvertType(parent, node, replacer)
   101  	case *ConvertUsingExpr:
   102  		return a.rewriteRefOfConvertUsingExpr(parent, node, replacer)
   103  	case *CreateDatabase:
   104  		return a.rewriteRefOfCreateDatabase(parent, node, replacer)
   105  	case *CreateTable:
   106  		return a.rewriteRefOfCreateTable(parent, node, replacer)
   107  	case *CreateView:
   108  		return a.rewriteRefOfCreateView(parent, node, replacer)
   109  	case *CurTimeFuncExpr:
   110  		return a.rewriteRefOfCurTimeFuncExpr(parent, node, replacer)
   111  	case *Default:
   112  		return a.rewriteRefOfDefault(parent, node, replacer)
   113  	case *Delete:
   114  		return a.rewriteRefOfDelete(parent, node, replacer)
   115  	case *DerivedTable:
   116  		return a.rewriteRefOfDerivedTable(parent, node, replacer)
   117  	case *DropColumn:
   118  		return a.rewriteRefOfDropColumn(parent, node, replacer)
   119  	case *DropDatabase:
   120  		return a.rewriteRefOfDropDatabase(parent, node, replacer)
   121  	case *DropKey:
   122  		return a.rewriteRefOfDropKey(parent, node, replacer)
   123  	case *DropTable:
   124  		return a.rewriteRefOfDropTable(parent, node, replacer)
   125  	case *DropView:
   126  		return a.rewriteRefOfDropView(parent, node, replacer)
   127  	case *ExistsExpr:
   128  		return a.rewriteRefOfExistsExpr(parent, node, replacer)
   129  	case *ExplainStmt:
   130  		return a.rewriteRefOfExplainStmt(parent, node, replacer)
   131  	case *ExplainTab:
   132  		return a.rewriteRefOfExplainTab(parent, node, replacer)
   133  	case *ExprOrColumns:
   134  		return a.rewriteRefOfExprOrColumns(parent, node, replacer)
   135  	case Exprs:
   136  		return a.rewriteExprs(parent, node, replacer)
   137  	case *ExtractFuncExpr:
   138  		return a.rewriteRefOfExtractFuncExpr(parent, node, replacer)
   139  	case *ExtractedSubquery:
   140  		return a.rewriteRefOfExtractedSubquery(parent, node, replacer)
   141  	case *Flush:
   142  		return a.rewriteRefOfFlush(parent, node, replacer)
   143  	case *Force:
   144  		return a.rewriteRefOfForce(parent, node, replacer)
   145  	case *ForeignKeyDefinition:
   146  		return a.rewriteRefOfForeignKeyDefinition(parent, node, replacer)
   147  	case *FuncExpr:
   148  		return a.rewriteRefOfFuncExpr(parent, node, replacer)
   149  	case GroupBy:
   150  		return a.rewriteGroupBy(parent, node, replacer)
   151  	case *GroupConcatExpr:
   152  		return a.rewriteRefOfGroupConcatExpr(parent, node, replacer)
   153  	case *IndexDefinition:
   154  		return a.rewriteRefOfIndexDefinition(parent, node, replacer)
   155  	case *IndexHints:
   156  		return a.rewriteRefOfIndexHints(parent, node, replacer)
   157  	case *IndexInfo:
   158  		return a.rewriteRefOfIndexInfo(parent, node, replacer)
   159  	case *Insert:
   160  		return a.rewriteRefOfInsert(parent, node, replacer)
   161  	case *IntervalExpr:
   162  		return a.rewriteRefOfIntervalExpr(parent, node, replacer)
   163  	case *IntroducerExpr:
   164  		return a.rewriteRefOfIntroducerExpr(parent, node, replacer)
   165  	case *IsExpr:
   166  		return a.rewriteRefOfIsExpr(parent, node, replacer)
   167  	case IsolationLevel:
   168  		return a.rewriteIsolationLevel(parent, node, replacer)
   169  	case *JoinCondition:
   170  		return a.rewriteRefOfJoinCondition(parent, node, replacer)
   171  	case *JoinTableExpr:
   172  		return a.rewriteRefOfJoinTableExpr(parent, node, replacer)
   173  	case *KeyState:
   174  		return a.rewriteRefOfKeyState(parent, node, replacer)
   175  	case *Limit:
   176  		return a.rewriteRefOfLimit(parent, node, replacer)
   177  	case ListArg:
   178  		return a.rewriteListArg(parent, node, replacer)
   179  	case *Literal:
   180  		return a.rewriteRefOfLiteral(parent, node, replacer)
   181  	case *Load:
   182  		return a.rewriteRefOfLoad(parent, node, replacer)
   183  	case *LockOption:
   184  		return a.rewriteRefOfLockOption(parent, node, replacer)
   185  	case *LockTables:
   186  		return a.rewriteRefOfLockTables(parent, node, replacer)
   187  	case *MatchExpr:
   188  		return a.rewriteRefOfMatchExpr(parent, node, replacer)
   189  	case *ModifyColumn:
   190  		return a.rewriteRefOfModifyColumn(parent, node, replacer)
   191  	case *Nextval:
   192  		return a.rewriteRefOfNextval(parent, node, replacer)
   193  	case *NotExpr:
   194  		return a.rewriteRefOfNotExpr(parent, node, replacer)
   195  	case *NullVal:
   196  		return a.rewriteRefOfNullVal(parent, node, replacer)
   197  	case OnDup:
   198  		return a.rewriteOnDup(parent, node, replacer)
   199  	case *OptLike:
   200  		return a.rewriteRefOfOptLike(parent, node, replacer)
   201  	case *OrExpr:
   202  		return a.rewriteRefOfOrExpr(parent, node, replacer)
   203  	case *Order:
   204  		return a.rewriteRefOfOrder(parent, node, replacer)
   205  	case OrderBy:
   206  		return a.rewriteOrderBy(parent, node, replacer)
   207  	case *OrderByOption:
   208  		return a.rewriteRefOfOrderByOption(parent, node, replacer)
   209  	case *OtherAdmin:
   210  		return a.rewriteRefOfOtherAdmin(parent, node, replacer)
   211  	case *OtherRead:
   212  		return a.rewriteRefOfOtherRead(parent, node, replacer)
   213  	case *ParenTableExpr:
   214  		return a.rewriteRefOfParenTableExpr(parent, node, replacer)
   215  	case *PartitionDefinition:
   216  		return a.rewriteRefOfPartitionDefinition(parent, node, replacer)
   217  	case *PartitionOption:
   218  		return a.rewriteRefOfPartitionOption(parent, node, replacer)
   219  	case *PartitionSpec:
   220  		return a.rewriteRefOfPartitionSpec(parent, node, replacer)
   221  	case Partitions:
   222  		return a.rewritePartitions(parent, node, replacer)
   223  	case ReferenceAction:
   224  		return a.rewriteReferenceAction(parent, node, replacer)
   225  	case *ReferenceDefinition:
   226  		return a.rewriteRefOfReferenceDefinition(parent, node, replacer)
   227  	case *Release:
   228  		return a.rewriteRefOfRelease(parent, node, replacer)
   229  	case *RenameIndex:
   230  		return a.rewriteRefOfRenameIndex(parent, node, replacer)
   231  	case *RenameTable:
   232  		return a.rewriteRefOfRenameTable(parent, node, replacer)
   233  	case *RenameTableName:
   234  		return a.rewriteRefOfRenameTableName(parent, node, replacer)
   235  	case *RevertMigration:
   236  		return a.rewriteRefOfRevertMigration(parent, node, replacer)
   237  	case *Rollback:
   238  		return a.rewriteRefOfRollback(parent, node, replacer)
   239  	case RootNode:
   240  		return a.rewriteRootNode(parent, node, replacer)
   241  	case *SRollback:
   242  		return a.rewriteRefOfSRollback(parent, node, replacer)
   243  	case *Savepoint:
   244  		return a.rewriteRefOfSavepoint(parent, node, replacer)
   245  	case *Select:
   246  		return a.rewriteRefOfSelect(parent, node, replacer)
   247  	case SelectExprs:
   248  		return a.rewriteSelectExprs(parent, node, replacer)
   249  	case *SelectInto:
   250  		return a.rewriteRefOfSelectInto(parent, node, replacer)
   251  	case *Set:
   252  		return a.rewriteRefOfSet(parent, node, replacer)
   253  	case *SetExpr:
   254  		return a.rewriteRefOfSetExpr(parent, node, replacer)
   255  	case SetExprs:
   256  		return a.rewriteSetExprs(parent, node, replacer)
   257  	case *SetTransaction:
   258  		return a.rewriteRefOfSetTransaction(parent, node, replacer)
   259  	case *Show:
   260  		return a.rewriteRefOfShow(parent, node, replacer)
   261  	case *ShowBasic:
   262  		return a.rewriteRefOfShowBasic(parent, node, replacer)
   263  	case *ShowCreate:
   264  		return a.rewriteRefOfShowCreate(parent, node, replacer)
   265  	case *ShowFilter:
   266  		return a.rewriteRefOfShowFilter(parent, node, replacer)
   267  	case *ShowLegacy:
   268  		return a.rewriteRefOfShowLegacy(parent, node, replacer)
   269  	case *ShowMigrationLogs:
   270  		return a.rewriteRefOfShowMigrationLogs(parent, node, replacer)
   271  	case *StarExpr:
   272  		return a.rewriteRefOfStarExpr(parent, node, replacer)
   273  	case *Stream:
   274  		return a.rewriteRefOfStream(parent, node, replacer)
   275  	case *SubPartition:
   276  		return a.rewriteRefOfSubPartition(parent, node, replacer)
   277  	case *Subquery:
   278  		return a.rewriteRefOfSubquery(parent, node, replacer)
   279  	case *SubstrExpr:
   280  		return a.rewriteRefOfSubstrExpr(parent, node, replacer)
   281  	case TableExprs:
   282  		return a.rewriteTableExprs(parent, node, replacer)
   283  	case TableIdent:
   284  		return a.rewriteTableIdent(parent, node, replacer)
   285  	case TableName:
   286  		return a.rewriteTableName(parent, node, replacer)
   287  	case TableNames:
   288  		return a.rewriteTableNames(parent, node, replacer)
   289  	case TableOptions:
   290  		return a.rewriteTableOptions(parent, node, replacer)
   291  	case *TableSpec:
   292  		return a.rewriteRefOfTableSpec(parent, node, replacer)
   293  	case *TablespaceOperation:
   294  		return a.rewriteRefOfTablespaceOperation(parent, node, replacer)
   295  	case *TimestampFuncExpr:
   296  		return a.rewriteRefOfTimestampFuncExpr(parent, node, replacer)
   297  	case *TruncateTable:
   298  		return a.rewriteRefOfTruncateTable(parent, node, replacer)
   299  	case *UnaryExpr:
   300  		return a.rewriteRefOfUnaryExpr(parent, node, replacer)
   301  	case *Union:
   302  		return a.rewriteRefOfUnion(parent, node, replacer)
   303  	case *UnlockTables:
   304  		return a.rewriteRefOfUnlockTables(parent, node, replacer)
   305  	case *Update:
   306  		return a.rewriteRefOfUpdate(parent, node, replacer)
   307  	case *UpdateExpr:
   308  		return a.rewriteRefOfUpdateExpr(parent, node, replacer)
   309  	case UpdateExprs:
   310  		return a.rewriteUpdateExprs(parent, node, replacer)
   311  	case *Use:
   312  		return a.rewriteRefOfUse(parent, node, replacer)
   313  	case *VStream:
   314  		return a.rewriteRefOfVStream(parent, node, replacer)
   315  	case ValTuple:
   316  		return a.rewriteValTuple(parent, node, replacer)
   317  	case *Validation:
   318  		return a.rewriteRefOfValidation(parent, node, replacer)
   319  	case Values:
   320  		return a.rewriteValues(parent, node, replacer)
   321  	case *ValuesFuncExpr:
   322  		return a.rewriteRefOfValuesFuncExpr(parent, node, replacer)
   323  	case VindexParam:
   324  		return a.rewriteVindexParam(parent, node, replacer)
   325  	case *VindexSpec:
   326  		return a.rewriteRefOfVindexSpec(parent, node, replacer)
   327  	case *When:
   328  		return a.rewriteRefOfWhen(parent, node, replacer)
   329  	case *Where:
   330  		return a.rewriteRefOfWhere(parent, node, replacer)
   331  	case *With:
   332  		return a.rewriteRefOfWith(parent, node, replacer)
   333  	case *XorExpr:
   334  		return a.rewriteRefOfXorExpr(parent, node, replacer)
   335  	default:
   336  		// this should never happen
   337  		return true
   338  	}
   339  }
   340  func (a *application) rewriteRefOfAddColumns(parent SQLNode, node *AddColumns, replacer replacerFunc) bool {
   341  	if node == nil {
   342  		return true
   343  	}
   344  	if a.pre != nil {
   345  		a.cur.replacer = replacer
   346  		a.cur.parent = parent
   347  		a.cur.node = node
   348  		if !a.pre(&a.cur) {
   349  			return true
   350  		}
   351  	}
   352  	for x, el := range node.Columns {
   353  		if !a.rewriteRefOfColumnDefinition(node, el, func(idx int) replacerFunc {
   354  			return func(newNode, parent SQLNode) {
   355  				parent.(*AddColumns).Columns[idx] = newNode.(*ColumnDefinition)
   356  			}
   357  		}(x)) {
   358  			return false
   359  		}
   360  	}
   361  	if !a.rewriteRefOfColName(node, node.After, func(newNode, parent SQLNode) {
   362  		parent.(*AddColumns).After = newNode.(*ColName)
   363  	}) {
   364  		return false
   365  	}
   366  	if a.post != nil {
   367  		a.cur.replacer = replacer
   368  		a.cur.parent = parent
   369  		a.cur.node = node
   370  		if !a.post(&a.cur) {
   371  			return false
   372  		}
   373  	}
   374  	return true
   375  }
   376  func (a *application) rewriteRefOfAddConstraintDefinition(parent SQLNode, node *AddConstraintDefinition, replacer replacerFunc) bool {
   377  	if node == nil {
   378  		return true
   379  	}
   380  	if a.pre != nil {
   381  		a.cur.replacer = replacer
   382  		a.cur.parent = parent
   383  		a.cur.node = node
   384  		if !a.pre(&a.cur) {
   385  			return true
   386  		}
   387  	}
   388  	if !a.rewriteRefOfConstraintDefinition(node, node.ConstraintDefinition, func(newNode, parent SQLNode) {
   389  		parent.(*AddConstraintDefinition).ConstraintDefinition = newNode.(*ConstraintDefinition)
   390  	}) {
   391  		return false
   392  	}
   393  	if a.post != nil {
   394  		a.cur.replacer = replacer
   395  		a.cur.parent = parent
   396  		a.cur.node = node
   397  		if !a.post(&a.cur) {
   398  			return false
   399  		}
   400  	}
   401  	return true
   402  }
   403  func (a *application) rewriteRefOfAddIndexDefinition(parent SQLNode, node *AddIndexDefinition, replacer replacerFunc) bool {
   404  	if node == nil {
   405  		return true
   406  	}
   407  	if a.pre != nil {
   408  		a.cur.replacer = replacer
   409  		a.cur.parent = parent
   410  		a.cur.node = node
   411  		if !a.pre(&a.cur) {
   412  			return true
   413  		}
   414  	}
   415  	if !a.rewriteRefOfIndexDefinition(node, node.IndexDefinition, func(newNode, parent SQLNode) {
   416  		parent.(*AddIndexDefinition).IndexDefinition = newNode.(*IndexDefinition)
   417  	}) {
   418  		return false
   419  	}
   420  	if a.post != nil {
   421  		a.cur.replacer = replacer
   422  		a.cur.parent = parent
   423  		a.cur.node = node
   424  		if !a.post(&a.cur) {
   425  			return false
   426  		}
   427  	}
   428  	return true
   429  }
   430  func (a *application) rewriteRefOfAliasedExpr(parent SQLNode, node *AliasedExpr, replacer replacerFunc) bool {
   431  	if node == nil {
   432  		return true
   433  	}
   434  	if a.pre != nil {
   435  		a.cur.replacer = replacer
   436  		a.cur.parent = parent
   437  		a.cur.node = node
   438  		if !a.pre(&a.cur) {
   439  			return true
   440  		}
   441  	}
   442  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
   443  		parent.(*AliasedExpr).Expr = newNode.(Expr)
   444  	}) {
   445  		return false
   446  	}
   447  	if !a.rewriteColIdent(node, node.As, func(newNode, parent SQLNode) {
   448  		parent.(*AliasedExpr).As = newNode.(ColIdent)
   449  	}) {
   450  		return false
   451  	}
   452  	if a.post != nil {
   453  		a.cur.replacer = replacer
   454  		a.cur.parent = parent
   455  		a.cur.node = node
   456  		if !a.post(&a.cur) {
   457  			return false
   458  		}
   459  	}
   460  	return true
   461  }
   462  func (a *application) rewriteRefOfAliasedTableExpr(parent SQLNode, node *AliasedTableExpr, replacer replacerFunc) bool {
   463  	if node == nil {
   464  		return true
   465  	}
   466  	if a.pre != nil {
   467  		a.cur.replacer = replacer
   468  		a.cur.parent = parent
   469  		a.cur.node = node
   470  		if !a.pre(&a.cur) {
   471  			return true
   472  		}
   473  	}
   474  	if !a.rewriteSimpleTableExpr(node, node.Expr, func(newNode, parent SQLNode) {
   475  		parent.(*AliasedTableExpr).Expr = newNode.(SimpleTableExpr)
   476  	}) {
   477  		return false
   478  	}
   479  	if !a.rewritePartitions(node, node.Partitions, func(newNode, parent SQLNode) {
   480  		parent.(*AliasedTableExpr).Partitions = newNode.(Partitions)
   481  	}) {
   482  		return false
   483  	}
   484  	if !a.rewriteTableIdent(node, node.As, func(newNode, parent SQLNode) {
   485  		parent.(*AliasedTableExpr).As = newNode.(TableIdent)
   486  	}) {
   487  		return false
   488  	}
   489  	if !a.rewriteRefOfIndexHints(node, node.Hints, func(newNode, parent SQLNode) {
   490  		parent.(*AliasedTableExpr).Hints = newNode.(*IndexHints)
   491  	}) {
   492  		return false
   493  	}
   494  	if !a.rewriteColumns(node, node.Columns, func(newNode, parent SQLNode) {
   495  		parent.(*AliasedTableExpr).Columns = newNode.(Columns)
   496  	}) {
   497  		return false
   498  	}
   499  	if a.post != nil {
   500  		a.cur.replacer = replacer
   501  		a.cur.parent = parent
   502  		a.cur.node = node
   503  		if !a.post(&a.cur) {
   504  			return false
   505  		}
   506  	}
   507  	return true
   508  }
   509  func (a *application) rewriteRefOfAlterCharset(parent SQLNode, node *AlterCharset, replacer replacerFunc) bool {
   510  	if node == nil {
   511  		return true
   512  	}
   513  	if a.pre != nil {
   514  		a.cur.replacer = replacer
   515  		a.cur.parent = parent
   516  		a.cur.node = node
   517  		if !a.pre(&a.cur) {
   518  			return true
   519  		}
   520  	}
   521  	if a.post != nil {
   522  		if a.pre == nil {
   523  			a.cur.replacer = replacer
   524  			a.cur.parent = parent
   525  			a.cur.node = node
   526  		}
   527  		if !a.post(&a.cur) {
   528  			return false
   529  		}
   530  	}
   531  	return true
   532  }
   533  func (a *application) rewriteRefOfAlterColumn(parent SQLNode, node *AlterColumn, replacer replacerFunc) bool {
   534  	if node == nil {
   535  		return true
   536  	}
   537  	if a.pre != nil {
   538  		a.cur.replacer = replacer
   539  		a.cur.parent = parent
   540  		a.cur.node = node
   541  		if !a.pre(&a.cur) {
   542  			return true
   543  		}
   544  	}
   545  	if !a.rewriteRefOfColName(node, node.Column, func(newNode, parent SQLNode) {
   546  		parent.(*AlterColumn).Column = newNode.(*ColName)
   547  	}) {
   548  		return false
   549  	}
   550  	if !a.rewriteExpr(node, node.DefaultVal, func(newNode, parent SQLNode) {
   551  		parent.(*AlterColumn).DefaultVal = newNode.(Expr)
   552  	}) {
   553  		return false
   554  	}
   555  	if a.post != nil {
   556  		a.cur.replacer = replacer
   557  		a.cur.parent = parent
   558  		a.cur.node = node
   559  		if !a.post(&a.cur) {
   560  			return false
   561  		}
   562  	}
   563  	return true
   564  }
   565  func (a *application) rewriteRefOfAlterDatabase(parent SQLNode, node *AlterDatabase, replacer replacerFunc) bool {
   566  	if node == nil {
   567  		return true
   568  	}
   569  	if a.pre != nil {
   570  		a.cur.replacer = replacer
   571  		a.cur.parent = parent
   572  		a.cur.node = node
   573  		if !a.pre(&a.cur) {
   574  			return true
   575  		}
   576  	}
   577  	if !a.rewriteTableIdent(node, node.DBName, func(newNode, parent SQLNode) {
   578  		parent.(*AlterDatabase).DBName = newNode.(TableIdent)
   579  	}) {
   580  		return false
   581  	}
   582  	if a.post != nil {
   583  		a.cur.replacer = replacer
   584  		a.cur.parent = parent
   585  		a.cur.node = node
   586  		if !a.post(&a.cur) {
   587  			return false
   588  		}
   589  	}
   590  	return true
   591  }
   592  func (a *application) rewriteRefOfAlterMigration(parent SQLNode, node *AlterMigration, replacer replacerFunc) bool {
   593  	if node == nil {
   594  		return true
   595  	}
   596  	if a.pre != nil {
   597  		a.cur.replacer = replacer
   598  		a.cur.parent = parent
   599  		a.cur.node = node
   600  		if !a.pre(&a.cur) {
   601  			return true
   602  		}
   603  	}
   604  	if a.post != nil {
   605  		if a.pre == nil {
   606  			a.cur.replacer = replacer
   607  			a.cur.parent = parent
   608  			a.cur.node = node
   609  		}
   610  		if !a.post(&a.cur) {
   611  			return false
   612  		}
   613  	}
   614  	return true
   615  }
   616  func (a *application) rewriteRefOfAlterTable(parent SQLNode, node *AlterTable, replacer replacerFunc) bool {
   617  	if node == nil {
   618  		return true
   619  	}
   620  	if a.pre != nil {
   621  		a.cur.replacer = replacer
   622  		a.cur.parent = parent
   623  		a.cur.node = node
   624  		if !a.pre(&a.cur) {
   625  			return true
   626  		}
   627  	}
   628  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
   629  		parent.(*AlterTable).Table = newNode.(TableName)
   630  	}) {
   631  		return false
   632  	}
   633  	for x, el := range node.AlterOptions {
   634  		if !a.rewriteAlterOption(node, el, func(idx int) replacerFunc {
   635  			return func(newNode, parent SQLNode) {
   636  				parent.(*AlterTable).AlterOptions[idx] = newNode.(AlterOption)
   637  			}
   638  		}(x)) {
   639  			return false
   640  		}
   641  	}
   642  	if !a.rewriteRefOfPartitionSpec(node, node.PartitionSpec, func(newNode, parent SQLNode) {
   643  		parent.(*AlterTable).PartitionSpec = newNode.(*PartitionSpec)
   644  	}) {
   645  		return false
   646  	}
   647  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
   648  		parent.(*AlterTable).Comments = newNode.(Comments)
   649  	}) {
   650  		return false
   651  	}
   652  	if a.post != nil {
   653  		a.cur.replacer = replacer
   654  		a.cur.parent = parent
   655  		a.cur.node = node
   656  		if !a.post(&a.cur) {
   657  			return false
   658  		}
   659  	}
   660  	return true
   661  }
   662  func (a *application) rewriteRefOfAlterView(parent SQLNode, node *AlterView, replacer replacerFunc) bool {
   663  	if node == nil {
   664  		return true
   665  	}
   666  	if a.pre != nil {
   667  		a.cur.replacer = replacer
   668  		a.cur.parent = parent
   669  		a.cur.node = node
   670  		if !a.pre(&a.cur) {
   671  			return true
   672  		}
   673  	}
   674  	if !a.rewriteTableName(node, node.ViewName, func(newNode, parent SQLNode) {
   675  		parent.(*AlterView).ViewName = newNode.(TableName)
   676  	}) {
   677  		return false
   678  	}
   679  	if !a.rewriteColumns(node, node.Columns, func(newNode, parent SQLNode) {
   680  		parent.(*AlterView).Columns = newNode.(Columns)
   681  	}) {
   682  		return false
   683  	}
   684  	if !a.rewriteSelectStatement(node, node.Select, func(newNode, parent SQLNode) {
   685  		parent.(*AlterView).Select = newNode.(SelectStatement)
   686  	}) {
   687  		return false
   688  	}
   689  	if a.post != nil {
   690  		a.cur.replacer = replacer
   691  		a.cur.parent = parent
   692  		a.cur.node = node
   693  		if !a.post(&a.cur) {
   694  			return false
   695  		}
   696  	}
   697  	return true
   698  }
   699  func (a *application) rewriteRefOfAlterVschema(parent SQLNode, node *AlterVschema, replacer replacerFunc) bool {
   700  	if node == nil {
   701  		return true
   702  	}
   703  	if a.pre != nil {
   704  		a.cur.replacer = replacer
   705  		a.cur.parent = parent
   706  		a.cur.node = node
   707  		if !a.pre(&a.cur) {
   708  			return true
   709  		}
   710  	}
   711  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
   712  		parent.(*AlterVschema).Table = newNode.(TableName)
   713  	}) {
   714  		return false
   715  	}
   716  	if !a.rewriteRefOfVindexSpec(node, node.VindexSpec, func(newNode, parent SQLNode) {
   717  		parent.(*AlterVschema).VindexSpec = newNode.(*VindexSpec)
   718  	}) {
   719  		return false
   720  	}
   721  	for x, el := range node.VindexCols {
   722  		if !a.rewriteColIdent(node, el, func(idx int) replacerFunc {
   723  			return func(newNode, parent SQLNode) {
   724  				parent.(*AlterVschema).VindexCols[idx] = newNode.(ColIdent)
   725  			}
   726  		}(x)) {
   727  			return false
   728  		}
   729  	}
   730  	if !a.rewriteRefOfAutoIncSpec(node, node.AutoIncSpec, func(newNode, parent SQLNode) {
   731  		parent.(*AlterVschema).AutoIncSpec = newNode.(*AutoIncSpec)
   732  	}) {
   733  		return false
   734  	}
   735  	if a.post != nil {
   736  		a.cur.replacer = replacer
   737  		a.cur.parent = parent
   738  		a.cur.node = node
   739  		if !a.post(&a.cur) {
   740  			return false
   741  		}
   742  	}
   743  	return true
   744  }
   745  func (a *application) rewriteRefOfAndExpr(parent SQLNode, node *AndExpr, replacer replacerFunc) bool {
   746  	if node == nil {
   747  		return true
   748  	}
   749  	if a.pre != nil {
   750  		a.cur.replacer = replacer
   751  		a.cur.parent = parent
   752  		a.cur.node = node
   753  		if !a.pre(&a.cur) {
   754  			return true
   755  		}
   756  	}
   757  	if !a.rewriteExpr(node, node.Left, func(newNode, parent SQLNode) {
   758  		parent.(*AndExpr).Left = newNode.(Expr)
   759  	}) {
   760  		return false
   761  	}
   762  	if !a.rewriteExpr(node, node.Right, func(newNode, parent SQLNode) {
   763  		parent.(*AndExpr).Right = newNode.(Expr)
   764  	}) {
   765  		return false
   766  	}
   767  	if a.post != nil {
   768  		a.cur.replacer = replacer
   769  		a.cur.parent = parent
   770  		a.cur.node = node
   771  		if !a.post(&a.cur) {
   772  			return false
   773  		}
   774  	}
   775  	return true
   776  }
   777  func (a *application) rewriteRefOfAutoIncSpec(parent SQLNode, node *AutoIncSpec, replacer replacerFunc) bool {
   778  	if node == nil {
   779  		return true
   780  	}
   781  	if a.pre != nil {
   782  		a.cur.replacer = replacer
   783  		a.cur.parent = parent
   784  		a.cur.node = node
   785  		if !a.pre(&a.cur) {
   786  			return true
   787  		}
   788  	}
   789  	if !a.rewriteColIdent(node, node.Column, func(newNode, parent SQLNode) {
   790  		parent.(*AutoIncSpec).Column = newNode.(ColIdent)
   791  	}) {
   792  		return false
   793  	}
   794  	if !a.rewriteTableName(node, node.Sequence, func(newNode, parent SQLNode) {
   795  		parent.(*AutoIncSpec).Sequence = newNode.(TableName)
   796  	}) {
   797  		return false
   798  	}
   799  	if a.post != nil {
   800  		a.cur.replacer = replacer
   801  		a.cur.parent = parent
   802  		a.cur.node = node
   803  		if !a.post(&a.cur) {
   804  			return false
   805  		}
   806  	}
   807  	return true
   808  }
   809  func (a *application) rewriteRefOfBegin(parent SQLNode, node *Begin, replacer replacerFunc) bool {
   810  	if node == nil {
   811  		return true
   812  	}
   813  	if a.pre != nil {
   814  		a.cur.replacer = replacer
   815  		a.cur.parent = parent
   816  		a.cur.node = node
   817  		if !a.pre(&a.cur) {
   818  			return true
   819  		}
   820  	}
   821  	if a.post != nil {
   822  		if a.pre == nil {
   823  			a.cur.replacer = replacer
   824  			a.cur.parent = parent
   825  			a.cur.node = node
   826  		}
   827  		if !a.post(&a.cur) {
   828  			return false
   829  		}
   830  	}
   831  	return true
   832  }
   833  func (a *application) rewriteRefOfBetweenExpr(parent SQLNode, node *BetweenExpr, replacer replacerFunc) bool {
   834  	if node == nil {
   835  		return true
   836  	}
   837  	if a.pre != nil {
   838  		a.cur.replacer = replacer
   839  		a.cur.parent = parent
   840  		a.cur.node = node
   841  		if !a.pre(&a.cur) {
   842  			return true
   843  		}
   844  	}
   845  	if !a.rewriteExpr(node, node.Left, func(newNode, parent SQLNode) {
   846  		parent.(*BetweenExpr).Left = newNode.(Expr)
   847  	}) {
   848  		return false
   849  	}
   850  	if !a.rewriteExpr(node, node.From, func(newNode, parent SQLNode) {
   851  		parent.(*BetweenExpr).From = newNode.(Expr)
   852  	}) {
   853  		return false
   854  	}
   855  	if !a.rewriteExpr(node, node.To, func(newNode, parent SQLNode) {
   856  		parent.(*BetweenExpr).To = newNode.(Expr)
   857  	}) {
   858  		return false
   859  	}
   860  	if a.post != nil {
   861  		a.cur.replacer = replacer
   862  		a.cur.parent = parent
   863  		a.cur.node = node
   864  		if !a.post(&a.cur) {
   865  			return false
   866  		}
   867  	}
   868  	return true
   869  }
   870  func (a *application) rewriteRefOfBinaryExpr(parent SQLNode, node *BinaryExpr, replacer replacerFunc) bool {
   871  	if node == nil {
   872  		return true
   873  	}
   874  	if a.pre != nil {
   875  		a.cur.replacer = replacer
   876  		a.cur.parent = parent
   877  		a.cur.node = node
   878  		if !a.pre(&a.cur) {
   879  			return true
   880  		}
   881  	}
   882  	if !a.rewriteExpr(node, node.Left, func(newNode, parent SQLNode) {
   883  		parent.(*BinaryExpr).Left = newNode.(Expr)
   884  	}) {
   885  		return false
   886  	}
   887  	if !a.rewriteExpr(node, node.Right, func(newNode, parent SQLNode) {
   888  		parent.(*BinaryExpr).Right = newNode.(Expr)
   889  	}) {
   890  		return false
   891  	}
   892  	if a.post != nil {
   893  		a.cur.replacer = replacer
   894  		a.cur.parent = parent
   895  		a.cur.node = node
   896  		if !a.post(&a.cur) {
   897  			return false
   898  		}
   899  	}
   900  	return true
   901  }
   902  func (a *application) rewriteRefOfCallProc(parent SQLNode, node *CallProc, replacer replacerFunc) bool {
   903  	if node == nil {
   904  		return true
   905  	}
   906  	if a.pre != nil {
   907  		a.cur.replacer = replacer
   908  		a.cur.parent = parent
   909  		a.cur.node = node
   910  		if !a.pre(&a.cur) {
   911  			return true
   912  		}
   913  	}
   914  	if !a.rewriteTableName(node, node.Name, func(newNode, parent SQLNode) {
   915  		parent.(*CallProc).Name = newNode.(TableName)
   916  	}) {
   917  		return false
   918  	}
   919  	if !a.rewriteExprs(node, node.Params, func(newNode, parent SQLNode) {
   920  		parent.(*CallProc).Params = newNode.(Exprs)
   921  	}) {
   922  		return false
   923  	}
   924  	if a.post != nil {
   925  		a.cur.replacer = replacer
   926  		a.cur.parent = parent
   927  		a.cur.node = node
   928  		if !a.post(&a.cur) {
   929  			return false
   930  		}
   931  	}
   932  	return true
   933  }
   934  func (a *application) rewriteRefOfCaseExpr(parent SQLNode, node *CaseExpr, replacer replacerFunc) bool {
   935  	if node == nil {
   936  		return true
   937  	}
   938  	if a.pre != nil {
   939  		a.cur.replacer = replacer
   940  		a.cur.parent = parent
   941  		a.cur.node = node
   942  		if !a.pre(&a.cur) {
   943  			return true
   944  		}
   945  	}
   946  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
   947  		parent.(*CaseExpr).Expr = newNode.(Expr)
   948  	}) {
   949  		return false
   950  	}
   951  	for x, el := range node.Whens {
   952  		if !a.rewriteRefOfWhen(node, el, func(idx int) replacerFunc {
   953  			return func(newNode, parent SQLNode) {
   954  				parent.(*CaseExpr).Whens[idx] = newNode.(*When)
   955  			}
   956  		}(x)) {
   957  			return false
   958  		}
   959  	}
   960  	if !a.rewriteExpr(node, node.Else, func(newNode, parent SQLNode) {
   961  		parent.(*CaseExpr).Else = newNode.(Expr)
   962  	}) {
   963  		return false
   964  	}
   965  	if a.post != nil {
   966  		a.cur.replacer = replacer
   967  		a.cur.parent = parent
   968  		a.cur.node = node
   969  		if !a.post(&a.cur) {
   970  			return false
   971  		}
   972  	}
   973  	return true
   974  }
   975  func (a *application) rewriteRefOfChangeColumn(parent SQLNode, node *ChangeColumn, replacer replacerFunc) bool {
   976  	if node == nil {
   977  		return true
   978  	}
   979  	if a.pre != nil {
   980  		a.cur.replacer = replacer
   981  		a.cur.parent = parent
   982  		a.cur.node = node
   983  		if !a.pre(&a.cur) {
   984  			return true
   985  		}
   986  	}
   987  	if !a.rewriteRefOfColName(node, node.OldColumn, func(newNode, parent SQLNode) {
   988  		parent.(*ChangeColumn).OldColumn = newNode.(*ColName)
   989  	}) {
   990  		return false
   991  	}
   992  	if !a.rewriteRefOfColumnDefinition(node, node.NewColDefinition, func(newNode, parent SQLNode) {
   993  		parent.(*ChangeColumn).NewColDefinition = newNode.(*ColumnDefinition)
   994  	}) {
   995  		return false
   996  	}
   997  	if !a.rewriteRefOfColName(node, node.After, func(newNode, parent SQLNode) {
   998  		parent.(*ChangeColumn).After = newNode.(*ColName)
   999  	}) {
  1000  		return false
  1001  	}
  1002  	if a.post != nil {
  1003  		a.cur.replacer = replacer
  1004  		a.cur.parent = parent
  1005  		a.cur.node = node
  1006  		if !a.post(&a.cur) {
  1007  			return false
  1008  		}
  1009  	}
  1010  	return true
  1011  }
  1012  func (a *application) rewriteRefOfCheckConstraintDefinition(parent SQLNode, node *CheckConstraintDefinition, replacer replacerFunc) bool {
  1013  	if node == nil {
  1014  		return true
  1015  	}
  1016  	if a.pre != nil {
  1017  		a.cur.replacer = replacer
  1018  		a.cur.parent = parent
  1019  		a.cur.node = node
  1020  		if !a.pre(&a.cur) {
  1021  			return true
  1022  		}
  1023  	}
  1024  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  1025  		parent.(*CheckConstraintDefinition).Expr = newNode.(Expr)
  1026  	}) {
  1027  		return false
  1028  	}
  1029  	if a.post != nil {
  1030  		a.cur.replacer = replacer
  1031  		a.cur.parent = parent
  1032  		a.cur.node = node
  1033  		if !a.post(&a.cur) {
  1034  			return false
  1035  		}
  1036  	}
  1037  	return true
  1038  }
  1039  func (a *application) rewriteColIdent(parent SQLNode, node ColIdent, replacer replacerFunc) bool {
  1040  	if a.pre != nil {
  1041  		a.cur.replacer = replacer
  1042  		a.cur.parent = parent
  1043  		a.cur.node = node
  1044  		if !a.pre(&a.cur) {
  1045  			return true
  1046  		}
  1047  	}
  1048  	if a.post != nil {
  1049  		if a.pre == nil {
  1050  			a.cur.replacer = replacer
  1051  			a.cur.parent = parent
  1052  			a.cur.node = node
  1053  		}
  1054  		if !a.post(&a.cur) {
  1055  			return false
  1056  		}
  1057  	}
  1058  	return true
  1059  }
  1060  func (a *application) rewriteRefOfColName(parent SQLNode, node *ColName, replacer replacerFunc) bool {
  1061  	if node == nil {
  1062  		return true
  1063  	}
  1064  	if a.pre != nil {
  1065  		a.cur.replacer = replacer
  1066  		a.cur.parent = parent
  1067  		a.cur.node = node
  1068  		if !a.pre(&a.cur) {
  1069  			return true
  1070  		}
  1071  	}
  1072  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  1073  		parent.(*ColName).Name = newNode.(ColIdent)
  1074  	}) {
  1075  		return false
  1076  	}
  1077  	if !a.rewriteTableName(node, node.Qualifier, func(newNode, parent SQLNode) {
  1078  		parent.(*ColName).Qualifier = newNode.(TableName)
  1079  	}) {
  1080  		return false
  1081  	}
  1082  	if a.post != nil {
  1083  		a.cur.replacer = replacer
  1084  		a.cur.parent = parent
  1085  		a.cur.node = node
  1086  		if !a.post(&a.cur) {
  1087  			return false
  1088  		}
  1089  	}
  1090  	return true
  1091  }
  1092  func (a *application) rewriteRefOfCollateExpr(parent SQLNode, node *CollateExpr, replacer replacerFunc) bool {
  1093  	if node == nil {
  1094  		return true
  1095  	}
  1096  	if a.pre != nil {
  1097  		a.cur.replacer = replacer
  1098  		a.cur.parent = parent
  1099  		a.cur.node = node
  1100  		if !a.pre(&a.cur) {
  1101  			return true
  1102  		}
  1103  	}
  1104  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  1105  		parent.(*CollateExpr).Expr = newNode.(Expr)
  1106  	}) {
  1107  		return false
  1108  	}
  1109  	if a.post != nil {
  1110  		a.cur.replacer = replacer
  1111  		a.cur.parent = parent
  1112  		a.cur.node = node
  1113  		if !a.post(&a.cur) {
  1114  			return false
  1115  		}
  1116  	}
  1117  	return true
  1118  }
  1119  func (a *application) rewriteRefOfColumnDefinition(parent SQLNode, node *ColumnDefinition, replacer replacerFunc) bool {
  1120  	if node == nil {
  1121  		return true
  1122  	}
  1123  	if a.pre != nil {
  1124  		a.cur.replacer = replacer
  1125  		a.cur.parent = parent
  1126  		a.cur.node = node
  1127  		if !a.pre(&a.cur) {
  1128  			return true
  1129  		}
  1130  	}
  1131  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  1132  		parent.(*ColumnDefinition).Name = newNode.(ColIdent)
  1133  	}) {
  1134  		return false
  1135  	}
  1136  	if a.post != nil {
  1137  		a.cur.replacer = replacer
  1138  		a.cur.parent = parent
  1139  		a.cur.node = node
  1140  		if !a.post(&a.cur) {
  1141  			return false
  1142  		}
  1143  	}
  1144  	return true
  1145  }
  1146  func (a *application) rewriteRefOfColumnType(parent SQLNode, node *ColumnType, replacer replacerFunc) bool {
  1147  	if node == nil {
  1148  		return true
  1149  	}
  1150  	if a.pre != nil {
  1151  		a.cur.replacer = replacer
  1152  		a.cur.parent = parent
  1153  		a.cur.node = node
  1154  		if !a.pre(&a.cur) {
  1155  			return true
  1156  		}
  1157  	}
  1158  	if !a.rewriteRefOfLiteral(node, node.Length, func(newNode, parent SQLNode) {
  1159  		parent.(*ColumnType).Length = newNode.(*Literal)
  1160  	}) {
  1161  		return false
  1162  	}
  1163  	if !a.rewriteRefOfLiteral(node, node.Scale, func(newNode, parent SQLNode) {
  1164  		parent.(*ColumnType).Scale = newNode.(*Literal)
  1165  	}) {
  1166  		return false
  1167  	}
  1168  	if a.post != nil {
  1169  		a.cur.replacer = replacer
  1170  		a.cur.parent = parent
  1171  		a.cur.node = node
  1172  		if !a.post(&a.cur) {
  1173  			return false
  1174  		}
  1175  	}
  1176  	return true
  1177  }
  1178  func (a *application) rewriteColumns(parent SQLNode, node Columns, replacer replacerFunc) bool {
  1179  	if node == nil {
  1180  		return true
  1181  	}
  1182  	if a.pre != nil {
  1183  		a.cur.replacer = replacer
  1184  		a.cur.parent = parent
  1185  		a.cur.node = node
  1186  		kontinue := !a.pre(&a.cur)
  1187  		if a.cur.revisit {
  1188  			node = a.cur.node.(Columns)
  1189  			a.cur.revisit = false
  1190  			return a.rewriteColumns(parent, node, replacer)
  1191  		}
  1192  		if kontinue {
  1193  			return true
  1194  		}
  1195  	}
  1196  	for x, el := range node {
  1197  		if !a.rewriteColIdent(node, el, func(idx int) replacerFunc {
  1198  			return func(newNode, parent SQLNode) {
  1199  				parent.(Columns)[idx] = newNode.(ColIdent)
  1200  			}
  1201  		}(x)) {
  1202  			return false
  1203  		}
  1204  	}
  1205  	if a.post != nil {
  1206  		a.cur.replacer = replacer
  1207  		a.cur.parent = parent
  1208  		a.cur.node = node
  1209  		if !a.post(&a.cur) {
  1210  			return false
  1211  		}
  1212  	}
  1213  	return true
  1214  }
  1215  func (a *application) rewriteComments(parent SQLNode, node Comments, replacer replacerFunc) bool {
  1216  	if node == nil {
  1217  		return true
  1218  	}
  1219  	if a.pre != nil {
  1220  		a.cur.replacer = replacer
  1221  		a.cur.parent = parent
  1222  		a.cur.node = node
  1223  		kontinue := !a.pre(&a.cur)
  1224  		if a.cur.revisit {
  1225  			node = a.cur.node.(Comments)
  1226  			a.cur.revisit = false
  1227  			return a.rewriteComments(parent, node, replacer)
  1228  		}
  1229  		if kontinue {
  1230  			return true
  1231  		}
  1232  	}
  1233  	if a.post != nil {
  1234  		if a.pre == nil {
  1235  			a.cur.replacer = replacer
  1236  			a.cur.parent = parent
  1237  			a.cur.node = node
  1238  		}
  1239  		if !a.post(&a.cur) {
  1240  			return false
  1241  		}
  1242  	}
  1243  	return true
  1244  }
  1245  func (a *application) rewriteRefOfCommit(parent SQLNode, node *Commit, replacer replacerFunc) bool {
  1246  	if node == nil {
  1247  		return true
  1248  	}
  1249  	if a.pre != nil {
  1250  		a.cur.replacer = replacer
  1251  		a.cur.parent = parent
  1252  		a.cur.node = node
  1253  		if !a.pre(&a.cur) {
  1254  			return true
  1255  		}
  1256  	}
  1257  	if a.post != nil {
  1258  		if a.pre == nil {
  1259  			a.cur.replacer = replacer
  1260  			a.cur.parent = parent
  1261  			a.cur.node = node
  1262  		}
  1263  		if !a.post(&a.cur) {
  1264  			return false
  1265  		}
  1266  	}
  1267  	return true
  1268  }
  1269  func (a *application) rewriteRefOfCommonTableExpr(parent SQLNode, node *CommonTableExpr, replacer replacerFunc) bool {
  1270  	if node == nil {
  1271  		return true
  1272  	}
  1273  	if a.pre != nil {
  1274  		a.cur.replacer = replacer
  1275  		a.cur.parent = parent
  1276  		a.cur.node = node
  1277  		if !a.pre(&a.cur) {
  1278  			return true
  1279  		}
  1280  	}
  1281  	if !a.rewriteTableIdent(node, node.TableID, func(newNode, parent SQLNode) {
  1282  		parent.(*CommonTableExpr).TableID = newNode.(TableIdent)
  1283  	}) {
  1284  		return false
  1285  	}
  1286  	if !a.rewriteColumns(node, node.Columns, func(newNode, parent SQLNode) {
  1287  		parent.(*CommonTableExpr).Columns = newNode.(Columns)
  1288  	}) {
  1289  		return false
  1290  	}
  1291  	if !a.rewriteRefOfSubquery(node, node.Subquery, func(newNode, parent SQLNode) {
  1292  		parent.(*CommonTableExpr).Subquery = newNode.(*Subquery)
  1293  	}) {
  1294  		return false
  1295  	}
  1296  	if a.post != nil {
  1297  		a.cur.replacer = replacer
  1298  		a.cur.parent = parent
  1299  		a.cur.node = node
  1300  		if !a.post(&a.cur) {
  1301  			return false
  1302  		}
  1303  	}
  1304  	return true
  1305  }
  1306  func (a *application) rewriteRefOfComparisonExpr(parent SQLNode, node *ComparisonExpr, replacer replacerFunc) bool {
  1307  	if node == nil {
  1308  		return true
  1309  	}
  1310  	if a.pre != nil {
  1311  		a.cur.replacer = replacer
  1312  		a.cur.parent = parent
  1313  		a.cur.node = node
  1314  		if !a.pre(&a.cur) {
  1315  			return true
  1316  		}
  1317  	}
  1318  	if !a.rewriteExpr(node, node.Left, func(newNode, parent SQLNode) {
  1319  		parent.(*ComparisonExpr).Left = newNode.(Expr)
  1320  	}) {
  1321  		return false
  1322  	}
  1323  	if !a.rewriteExpr(node, node.Right, func(newNode, parent SQLNode) {
  1324  		parent.(*ComparisonExpr).Right = newNode.(Expr)
  1325  	}) {
  1326  		return false
  1327  	}
  1328  	if !a.rewriteExpr(node, node.Escape, func(newNode, parent SQLNode) {
  1329  		parent.(*ComparisonExpr).Escape = newNode.(Expr)
  1330  	}) {
  1331  		return false
  1332  	}
  1333  	if a.post != nil {
  1334  		a.cur.replacer = replacer
  1335  		a.cur.parent = parent
  1336  		a.cur.node = node
  1337  		if !a.post(&a.cur) {
  1338  			return false
  1339  		}
  1340  	}
  1341  	return true
  1342  }
  1343  func (a *application) rewriteRefOfConstraintDefinition(parent SQLNode, node *ConstraintDefinition, replacer replacerFunc) bool {
  1344  	if node == nil {
  1345  		return true
  1346  	}
  1347  	if a.pre != nil {
  1348  		a.cur.replacer = replacer
  1349  		a.cur.parent = parent
  1350  		a.cur.node = node
  1351  		if !a.pre(&a.cur) {
  1352  			return true
  1353  		}
  1354  	}
  1355  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  1356  		parent.(*ConstraintDefinition).Name = newNode.(ColIdent)
  1357  	}) {
  1358  		return false
  1359  	}
  1360  	if !a.rewriteConstraintInfo(node, node.Details, func(newNode, parent SQLNode) {
  1361  		parent.(*ConstraintDefinition).Details = newNode.(ConstraintInfo)
  1362  	}) {
  1363  		return false
  1364  	}
  1365  	if a.post != nil {
  1366  		a.cur.replacer = replacer
  1367  		a.cur.parent = parent
  1368  		a.cur.node = node
  1369  		if !a.post(&a.cur) {
  1370  			return false
  1371  		}
  1372  	}
  1373  	return true
  1374  }
  1375  func (a *application) rewriteRefOfConvertExpr(parent SQLNode, node *ConvertExpr, replacer replacerFunc) bool {
  1376  	if node == nil {
  1377  		return true
  1378  	}
  1379  	if a.pre != nil {
  1380  		a.cur.replacer = replacer
  1381  		a.cur.parent = parent
  1382  		a.cur.node = node
  1383  		if !a.pre(&a.cur) {
  1384  			return true
  1385  		}
  1386  	}
  1387  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  1388  		parent.(*ConvertExpr).Expr = newNode.(Expr)
  1389  	}) {
  1390  		return false
  1391  	}
  1392  	if !a.rewriteRefOfConvertType(node, node.Type, func(newNode, parent SQLNode) {
  1393  		parent.(*ConvertExpr).Type = newNode.(*ConvertType)
  1394  	}) {
  1395  		return false
  1396  	}
  1397  	if a.post != nil {
  1398  		a.cur.replacer = replacer
  1399  		a.cur.parent = parent
  1400  		a.cur.node = node
  1401  		if !a.post(&a.cur) {
  1402  			return false
  1403  		}
  1404  	}
  1405  	return true
  1406  }
  1407  func (a *application) rewriteRefOfConvertType(parent SQLNode, node *ConvertType, replacer replacerFunc) bool {
  1408  	if node == nil {
  1409  		return true
  1410  	}
  1411  	if a.pre != nil {
  1412  		a.cur.replacer = replacer
  1413  		a.cur.parent = parent
  1414  		a.cur.node = node
  1415  		if !a.pre(&a.cur) {
  1416  			return true
  1417  		}
  1418  	}
  1419  	if !a.rewriteRefOfLiteral(node, node.Length, func(newNode, parent SQLNode) {
  1420  		parent.(*ConvertType).Length = newNode.(*Literal)
  1421  	}) {
  1422  		return false
  1423  	}
  1424  	if !a.rewriteRefOfLiteral(node, node.Scale, func(newNode, parent SQLNode) {
  1425  		parent.(*ConvertType).Scale = newNode.(*Literal)
  1426  	}) {
  1427  		return false
  1428  	}
  1429  	if a.post != nil {
  1430  		a.cur.replacer = replacer
  1431  		a.cur.parent = parent
  1432  		a.cur.node = node
  1433  		if !a.post(&a.cur) {
  1434  			return false
  1435  		}
  1436  	}
  1437  	return true
  1438  }
  1439  func (a *application) rewriteRefOfConvertUsingExpr(parent SQLNode, node *ConvertUsingExpr, replacer replacerFunc) bool {
  1440  	if node == nil {
  1441  		return true
  1442  	}
  1443  	if a.pre != nil {
  1444  		a.cur.replacer = replacer
  1445  		a.cur.parent = parent
  1446  		a.cur.node = node
  1447  		if !a.pre(&a.cur) {
  1448  			return true
  1449  		}
  1450  	}
  1451  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  1452  		parent.(*ConvertUsingExpr).Expr = newNode.(Expr)
  1453  	}) {
  1454  		return false
  1455  	}
  1456  	if a.post != nil {
  1457  		a.cur.replacer = replacer
  1458  		a.cur.parent = parent
  1459  		a.cur.node = node
  1460  		if !a.post(&a.cur) {
  1461  			return false
  1462  		}
  1463  	}
  1464  	return true
  1465  }
  1466  func (a *application) rewriteRefOfCreateDatabase(parent SQLNode, node *CreateDatabase, replacer replacerFunc) bool {
  1467  	if node == nil {
  1468  		return true
  1469  	}
  1470  	if a.pre != nil {
  1471  		a.cur.replacer = replacer
  1472  		a.cur.parent = parent
  1473  		a.cur.node = node
  1474  		if !a.pre(&a.cur) {
  1475  			return true
  1476  		}
  1477  	}
  1478  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  1479  		parent.(*CreateDatabase).Comments = newNode.(Comments)
  1480  	}) {
  1481  		return false
  1482  	}
  1483  	if !a.rewriteTableIdent(node, node.DBName, func(newNode, parent SQLNode) {
  1484  		parent.(*CreateDatabase).DBName = newNode.(TableIdent)
  1485  	}) {
  1486  		return false
  1487  	}
  1488  	if a.post != nil {
  1489  		a.cur.replacer = replacer
  1490  		a.cur.parent = parent
  1491  		a.cur.node = node
  1492  		if !a.post(&a.cur) {
  1493  			return false
  1494  		}
  1495  	}
  1496  	return true
  1497  }
  1498  func (a *application) rewriteRefOfCreateTable(parent SQLNode, node *CreateTable, replacer replacerFunc) bool {
  1499  	if node == nil {
  1500  		return true
  1501  	}
  1502  	if a.pre != nil {
  1503  		a.cur.replacer = replacer
  1504  		a.cur.parent = parent
  1505  		a.cur.node = node
  1506  		if !a.pre(&a.cur) {
  1507  			return true
  1508  		}
  1509  	}
  1510  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  1511  		parent.(*CreateTable).Table = newNode.(TableName)
  1512  	}) {
  1513  		return false
  1514  	}
  1515  	if !a.rewriteRefOfTableSpec(node, node.TableSpec, func(newNode, parent SQLNode) {
  1516  		parent.(*CreateTable).TableSpec = newNode.(*TableSpec)
  1517  	}) {
  1518  		return false
  1519  	}
  1520  	if !a.rewriteRefOfOptLike(node, node.OptLike, func(newNode, parent SQLNode) {
  1521  		parent.(*CreateTable).OptLike = newNode.(*OptLike)
  1522  	}) {
  1523  		return false
  1524  	}
  1525  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  1526  		parent.(*CreateTable).Comments = newNode.(Comments)
  1527  	}) {
  1528  		return false
  1529  	}
  1530  	if a.post != nil {
  1531  		a.cur.replacer = replacer
  1532  		a.cur.parent = parent
  1533  		a.cur.node = node
  1534  		if !a.post(&a.cur) {
  1535  			return false
  1536  		}
  1537  	}
  1538  	return true
  1539  }
  1540  func (a *application) rewriteRefOfCreateView(parent SQLNode, node *CreateView, replacer replacerFunc) bool {
  1541  	if node == nil {
  1542  		return true
  1543  	}
  1544  	if a.pre != nil {
  1545  		a.cur.replacer = replacer
  1546  		a.cur.parent = parent
  1547  		a.cur.node = node
  1548  		if !a.pre(&a.cur) {
  1549  			return true
  1550  		}
  1551  	}
  1552  	if !a.rewriteTableName(node, node.ViewName, func(newNode, parent SQLNode) {
  1553  		parent.(*CreateView).ViewName = newNode.(TableName)
  1554  	}) {
  1555  		return false
  1556  	}
  1557  	if !a.rewriteColumns(node, node.Columns, func(newNode, parent SQLNode) {
  1558  		parent.(*CreateView).Columns = newNode.(Columns)
  1559  	}) {
  1560  		return false
  1561  	}
  1562  	if !a.rewriteSelectStatement(node, node.Select, func(newNode, parent SQLNode) {
  1563  		parent.(*CreateView).Select = newNode.(SelectStatement)
  1564  	}) {
  1565  		return false
  1566  	}
  1567  	if a.post != nil {
  1568  		a.cur.replacer = replacer
  1569  		a.cur.parent = parent
  1570  		a.cur.node = node
  1571  		if !a.post(&a.cur) {
  1572  			return false
  1573  		}
  1574  	}
  1575  	return true
  1576  }
  1577  func (a *application) rewriteRefOfCurTimeFuncExpr(parent SQLNode, node *CurTimeFuncExpr, replacer replacerFunc) bool {
  1578  	if node == nil {
  1579  		return true
  1580  	}
  1581  	if a.pre != nil {
  1582  		a.cur.replacer = replacer
  1583  		a.cur.parent = parent
  1584  		a.cur.node = node
  1585  		if !a.pre(&a.cur) {
  1586  			return true
  1587  		}
  1588  	}
  1589  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  1590  		parent.(*CurTimeFuncExpr).Name = newNode.(ColIdent)
  1591  	}) {
  1592  		return false
  1593  	}
  1594  	if !a.rewriteExpr(node, node.Fsp, func(newNode, parent SQLNode) {
  1595  		parent.(*CurTimeFuncExpr).Fsp = newNode.(Expr)
  1596  	}) {
  1597  		return false
  1598  	}
  1599  	if a.post != nil {
  1600  		a.cur.replacer = replacer
  1601  		a.cur.parent = parent
  1602  		a.cur.node = node
  1603  		if !a.post(&a.cur) {
  1604  			return false
  1605  		}
  1606  	}
  1607  	return true
  1608  }
  1609  func (a *application) rewriteRefOfDefault(parent SQLNode, node *Default, replacer replacerFunc) bool {
  1610  	if node == nil {
  1611  		return true
  1612  	}
  1613  	if a.pre != nil {
  1614  		a.cur.replacer = replacer
  1615  		a.cur.parent = parent
  1616  		a.cur.node = node
  1617  		if !a.pre(&a.cur) {
  1618  			return true
  1619  		}
  1620  	}
  1621  	if a.post != nil {
  1622  		if a.pre == nil {
  1623  			a.cur.replacer = replacer
  1624  			a.cur.parent = parent
  1625  			a.cur.node = node
  1626  		}
  1627  		if !a.post(&a.cur) {
  1628  			return false
  1629  		}
  1630  	}
  1631  	return true
  1632  }
  1633  func (a *application) rewriteRefOfDelete(parent SQLNode, node *Delete, replacer replacerFunc) bool {
  1634  	if node == nil {
  1635  		return true
  1636  	}
  1637  	if a.pre != nil {
  1638  		a.cur.replacer = replacer
  1639  		a.cur.parent = parent
  1640  		a.cur.node = node
  1641  		if !a.pre(&a.cur) {
  1642  			return true
  1643  		}
  1644  	}
  1645  	if !a.rewriteRefOfWith(node, node.With, func(newNode, parent SQLNode) {
  1646  		parent.(*Delete).With = newNode.(*With)
  1647  	}) {
  1648  		return false
  1649  	}
  1650  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  1651  		parent.(*Delete).Comments = newNode.(Comments)
  1652  	}) {
  1653  		return false
  1654  	}
  1655  	if !a.rewriteTableNames(node, node.Targets, func(newNode, parent SQLNode) {
  1656  		parent.(*Delete).Targets = newNode.(TableNames)
  1657  	}) {
  1658  		return false
  1659  	}
  1660  	if !a.rewriteTableExprs(node, node.TableExprs, func(newNode, parent SQLNode) {
  1661  		parent.(*Delete).TableExprs = newNode.(TableExprs)
  1662  	}) {
  1663  		return false
  1664  	}
  1665  	if !a.rewritePartitions(node, node.Partitions, func(newNode, parent SQLNode) {
  1666  		parent.(*Delete).Partitions = newNode.(Partitions)
  1667  	}) {
  1668  		return false
  1669  	}
  1670  	if !a.rewriteRefOfWhere(node, node.Where, func(newNode, parent SQLNode) {
  1671  		parent.(*Delete).Where = newNode.(*Where)
  1672  	}) {
  1673  		return false
  1674  	}
  1675  	if !a.rewriteOrderBy(node, node.OrderBy, func(newNode, parent SQLNode) {
  1676  		parent.(*Delete).OrderBy = newNode.(OrderBy)
  1677  	}) {
  1678  		return false
  1679  	}
  1680  	if !a.rewriteRefOfLimit(node, node.Limit, func(newNode, parent SQLNode) {
  1681  		parent.(*Delete).Limit = newNode.(*Limit)
  1682  	}) {
  1683  		return false
  1684  	}
  1685  	if a.post != nil {
  1686  		a.cur.replacer = replacer
  1687  		a.cur.parent = parent
  1688  		a.cur.node = node
  1689  		if !a.post(&a.cur) {
  1690  			return false
  1691  		}
  1692  	}
  1693  	return true
  1694  }
  1695  func (a *application) rewriteRefOfDerivedTable(parent SQLNode, node *DerivedTable, replacer replacerFunc) bool {
  1696  	if node == nil {
  1697  		return true
  1698  	}
  1699  	if a.pre != nil {
  1700  		a.cur.replacer = replacer
  1701  		a.cur.parent = parent
  1702  		a.cur.node = node
  1703  		if !a.pre(&a.cur) {
  1704  			return true
  1705  		}
  1706  	}
  1707  	if !a.rewriteSelectStatement(node, node.Select, func(newNode, parent SQLNode) {
  1708  		parent.(*DerivedTable).Select = newNode.(SelectStatement)
  1709  	}) {
  1710  		return false
  1711  	}
  1712  	if a.post != nil {
  1713  		a.cur.replacer = replacer
  1714  		a.cur.parent = parent
  1715  		a.cur.node = node
  1716  		if !a.post(&a.cur) {
  1717  			return false
  1718  		}
  1719  	}
  1720  	return true
  1721  }
  1722  func (a *application) rewriteRefOfDropColumn(parent SQLNode, node *DropColumn, replacer replacerFunc) bool {
  1723  	if node == nil {
  1724  		return true
  1725  	}
  1726  	if a.pre != nil {
  1727  		a.cur.replacer = replacer
  1728  		a.cur.parent = parent
  1729  		a.cur.node = node
  1730  		if !a.pre(&a.cur) {
  1731  			return true
  1732  		}
  1733  	}
  1734  	if !a.rewriteRefOfColName(node, node.Name, func(newNode, parent SQLNode) {
  1735  		parent.(*DropColumn).Name = newNode.(*ColName)
  1736  	}) {
  1737  		return false
  1738  	}
  1739  	if a.post != nil {
  1740  		a.cur.replacer = replacer
  1741  		a.cur.parent = parent
  1742  		a.cur.node = node
  1743  		if !a.post(&a.cur) {
  1744  			return false
  1745  		}
  1746  	}
  1747  	return true
  1748  }
  1749  func (a *application) rewriteRefOfDropDatabase(parent SQLNode, node *DropDatabase, replacer replacerFunc) bool {
  1750  	if node == nil {
  1751  		return true
  1752  	}
  1753  	if a.pre != nil {
  1754  		a.cur.replacer = replacer
  1755  		a.cur.parent = parent
  1756  		a.cur.node = node
  1757  		if !a.pre(&a.cur) {
  1758  			return true
  1759  		}
  1760  	}
  1761  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  1762  		parent.(*DropDatabase).Comments = newNode.(Comments)
  1763  	}) {
  1764  		return false
  1765  	}
  1766  	if !a.rewriteTableIdent(node, node.DBName, func(newNode, parent SQLNode) {
  1767  		parent.(*DropDatabase).DBName = newNode.(TableIdent)
  1768  	}) {
  1769  		return false
  1770  	}
  1771  	if a.post != nil {
  1772  		a.cur.replacer = replacer
  1773  		a.cur.parent = parent
  1774  		a.cur.node = node
  1775  		if !a.post(&a.cur) {
  1776  			return false
  1777  		}
  1778  	}
  1779  	return true
  1780  }
  1781  func (a *application) rewriteRefOfDropKey(parent SQLNode, node *DropKey, replacer replacerFunc) bool {
  1782  	if node == nil {
  1783  		return true
  1784  	}
  1785  	if a.pre != nil {
  1786  		a.cur.replacer = replacer
  1787  		a.cur.parent = parent
  1788  		a.cur.node = node
  1789  		if !a.pre(&a.cur) {
  1790  			return true
  1791  		}
  1792  	}
  1793  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  1794  		parent.(*DropKey).Name = newNode.(ColIdent)
  1795  	}) {
  1796  		return false
  1797  	}
  1798  	if a.post != nil {
  1799  		a.cur.replacer = replacer
  1800  		a.cur.parent = parent
  1801  		a.cur.node = node
  1802  		if !a.post(&a.cur) {
  1803  			return false
  1804  		}
  1805  	}
  1806  	return true
  1807  }
  1808  func (a *application) rewriteRefOfDropTable(parent SQLNode, node *DropTable, replacer replacerFunc) bool {
  1809  	if node == nil {
  1810  		return true
  1811  	}
  1812  	if a.pre != nil {
  1813  		a.cur.replacer = replacer
  1814  		a.cur.parent = parent
  1815  		a.cur.node = node
  1816  		if !a.pre(&a.cur) {
  1817  			return true
  1818  		}
  1819  	}
  1820  	if !a.rewriteTableNames(node, node.FromTables, func(newNode, parent SQLNode) {
  1821  		parent.(*DropTable).FromTables = newNode.(TableNames)
  1822  	}) {
  1823  		return false
  1824  	}
  1825  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  1826  		parent.(*DropTable).Comments = newNode.(Comments)
  1827  	}) {
  1828  		return false
  1829  	}
  1830  	if a.post != nil {
  1831  		a.cur.replacer = replacer
  1832  		a.cur.parent = parent
  1833  		a.cur.node = node
  1834  		if !a.post(&a.cur) {
  1835  			return false
  1836  		}
  1837  	}
  1838  	return true
  1839  }
  1840  func (a *application) rewriteRefOfDropView(parent SQLNode, node *DropView, replacer replacerFunc) bool {
  1841  	if node == nil {
  1842  		return true
  1843  	}
  1844  	if a.pre != nil {
  1845  		a.cur.replacer = replacer
  1846  		a.cur.parent = parent
  1847  		a.cur.node = node
  1848  		if !a.pre(&a.cur) {
  1849  			return true
  1850  		}
  1851  	}
  1852  	if !a.rewriteTableNames(node, node.FromTables, func(newNode, parent SQLNode) {
  1853  		parent.(*DropView).FromTables = newNode.(TableNames)
  1854  	}) {
  1855  		return false
  1856  	}
  1857  	if a.post != nil {
  1858  		a.cur.replacer = replacer
  1859  		a.cur.parent = parent
  1860  		a.cur.node = node
  1861  		if !a.post(&a.cur) {
  1862  			return false
  1863  		}
  1864  	}
  1865  	return true
  1866  }
  1867  func (a *application) rewriteRefOfExistsExpr(parent SQLNode, node *ExistsExpr, replacer replacerFunc) bool {
  1868  	if node == nil {
  1869  		return true
  1870  	}
  1871  	if a.pre != nil {
  1872  		a.cur.replacer = replacer
  1873  		a.cur.parent = parent
  1874  		a.cur.node = node
  1875  		if !a.pre(&a.cur) {
  1876  			return true
  1877  		}
  1878  	}
  1879  	if !a.rewriteRefOfSubquery(node, node.Subquery, func(newNode, parent SQLNode) {
  1880  		parent.(*ExistsExpr).Subquery = newNode.(*Subquery)
  1881  	}) {
  1882  		return false
  1883  	}
  1884  	if a.post != nil {
  1885  		a.cur.replacer = replacer
  1886  		a.cur.parent = parent
  1887  		a.cur.node = node
  1888  		if !a.post(&a.cur) {
  1889  			return false
  1890  		}
  1891  	}
  1892  	return true
  1893  }
  1894  func (a *application) rewriteRefOfExplainStmt(parent SQLNode, node *ExplainStmt, replacer replacerFunc) bool {
  1895  	if node == nil {
  1896  		return true
  1897  	}
  1898  	if a.pre != nil {
  1899  		a.cur.replacer = replacer
  1900  		a.cur.parent = parent
  1901  		a.cur.node = node
  1902  		if !a.pre(&a.cur) {
  1903  			return true
  1904  		}
  1905  	}
  1906  	if !a.rewriteStatement(node, node.Statement, func(newNode, parent SQLNode) {
  1907  		parent.(*ExplainStmt).Statement = newNode.(Statement)
  1908  	}) {
  1909  		return false
  1910  	}
  1911  	if a.post != nil {
  1912  		a.cur.replacer = replacer
  1913  		a.cur.parent = parent
  1914  		a.cur.node = node
  1915  		if !a.post(&a.cur) {
  1916  			return false
  1917  		}
  1918  	}
  1919  	return true
  1920  }
  1921  func (a *application) rewriteRefOfExplainTab(parent SQLNode, node *ExplainTab, replacer replacerFunc) bool {
  1922  	if node == nil {
  1923  		return true
  1924  	}
  1925  	if a.pre != nil {
  1926  		a.cur.replacer = replacer
  1927  		a.cur.parent = parent
  1928  		a.cur.node = node
  1929  		if !a.pre(&a.cur) {
  1930  			return true
  1931  		}
  1932  	}
  1933  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  1934  		parent.(*ExplainTab).Table = newNode.(TableName)
  1935  	}) {
  1936  		return false
  1937  	}
  1938  	if a.post != nil {
  1939  		a.cur.replacer = replacer
  1940  		a.cur.parent = parent
  1941  		a.cur.node = node
  1942  		if !a.post(&a.cur) {
  1943  			return false
  1944  		}
  1945  	}
  1946  	return true
  1947  }
  1948  func (a *application) rewriteRefOfExprOrColumns(parent SQLNode, node *ExprOrColumns, replacer replacerFunc) bool {
  1949  	if node == nil {
  1950  		return true
  1951  	}
  1952  	if a.pre != nil {
  1953  		a.cur.replacer = replacer
  1954  		a.cur.parent = parent
  1955  		a.cur.node = node
  1956  		if !a.pre(&a.cur) {
  1957  			return true
  1958  		}
  1959  	}
  1960  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  1961  		parent.(*ExprOrColumns).Expr = newNode.(Expr)
  1962  	}) {
  1963  		return false
  1964  	}
  1965  	if !a.rewriteColumns(node, node.ColumnList, func(newNode, parent SQLNode) {
  1966  		parent.(*ExprOrColumns).ColumnList = newNode.(Columns)
  1967  	}) {
  1968  		return false
  1969  	}
  1970  	if a.post != nil {
  1971  		a.cur.replacer = replacer
  1972  		a.cur.parent = parent
  1973  		a.cur.node = node
  1974  		if !a.post(&a.cur) {
  1975  			return false
  1976  		}
  1977  	}
  1978  	return true
  1979  }
  1980  func (a *application) rewriteExprs(parent SQLNode, node Exprs, replacer replacerFunc) bool {
  1981  	if node == nil {
  1982  		return true
  1983  	}
  1984  	if a.pre != nil {
  1985  		a.cur.replacer = replacer
  1986  		a.cur.parent = parent
  1987  		a.cur.node = node
  1988  		kontinue := !a.pre(&a.cur)
  1989  		if a.cur.revisit {
  1990  			node = a.cur.node.(Exprs)
  1991  			a.cur.revisit = false
  1992  			return a.rewriteExprs(parent, node, replacer)
  1993  		}
  1994  		if kontinue {
  1995  			return true
  1996  		}
  1997  	}
  1998  	for x, el := range node {
  1999  		if !a.rewriteExpr(node, el, func(idx int) replacerFunc {
  2000  			return func(newNode, parent SQLNode) {
  2001  				parent.(Exprs)[idx] = newNode.(Expr)
  2002  			}
  2003  		}(x)) {
  2004  			return false
  2005  		}
  2006  	}
  2007  	if a.post != nil {
  2008  		a.cur.replacer = replacer
  2009  		a.cur.parent = parent
  2010  		a.cur.node = node
  2011  		if !a.post(&a.cur) {
  2012  			return false
  2013  		}
  2014  	}
  2015  	return true
  2016  }
  2017  func (a *application) rewriteRefOfExtractFuncExpr(parent SQLNode, node *ExtractFuncExpr, replacer replacerFunc) bool {
  2018  	if node == nil {
  2019  		return true
  2020  	}
  2021  	if a.pre != nil {
  2022  		a.cur.replacer = replacer
  2023  		a.cur.parent = parent
  2024  		a.cur.node = node
  2025  		if !a.pre(&a.cur) {
  2026  			return true
  2027  		}
  2028  	}
  2029  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  2030  		parent.(*ExtractFuncExpr).Expr = newNode.(Expr)
  2031  	}) {
  2032  		return false
  2033  	}
  2034  	if a.post != nil {
  2035  		a.cur.replacer = replacer
  2036  		a.cur.parent = parent
  2037  		a.cur.node = node
  2038  		if !a.post(&a.cur) {
  2039  			return false
  2040  		}
  2041  	}
  2042  	return true
  2043  }
  2044  func (a *application) rewriteRefOfExtractedSubquery(parent SQLNode, node *ExtractedSubquery, replacer replacerFunc) bool {
  2045  	if node == nil {
  2046  		return true
  2047  	}
  2048  	if a.pre != nil {
  2049  		a.cur.replacer = replacer
  2050  		a.cur.parent = parent
  2051  		a.cur.node = node
  2052  		if !a.pre(&a.cur) {
  2053  			return true
  2054  		}
  2055  	}
  2056  	if !a.rewriteExpr(node, node.Original, func(newNode, parent SQLNode) {
  2057  		parent.(*ExtractedSubquery).Original = newNode.(Expr)
  2058  	}) {
  2059  		return false
  2060  	}
  2061  	if !a.rewriteRefOfSubquery(node, node.Subquery, func(newNode, parent SQLNode) {
  2062  		parent.(*ExtractedSubquery).Subquery = newNode.(*Subquery)
  2063  	}) {
  2064  		return false
  2065  	}
  2066  	if !a.rewriteExpr(node, node.OtherSide, func(newNode, parent SQLNode) {
  2067  		parent.(*ExtractedSubquery).OtherSide = newNode.(Expr)
  2068  	}) {
  2069  		return false
  2070  	}
  2071  	if !a.rewriteExpr(node, node.alternative, func(newNode, parent SQLNode) {
  2072  		parent.(*ExtractedSubquery).alternative = newNode.(Expr)
  2073  	}) {
  2074  		return false
  2075  	}
  2076  	if a.post != nil {
  2077  		a.cur.replacer = replacer
  2078  		a.cur.parent = parent
  2079  		a.cur.node = node
  2080  		if !a.post(&a.cur) {
  2081  			return false
  2082  		}
  2083  	}
  2084  	return true
  2085  }
  2086  func (a *application) rewriteRefOfFlush(parent SQLNode, node *Flush, replacer replacerFunc) bool {
  2087  	if node == nil {
  2088  		return true
  2089  	}
  2090  	if a.pre != nil {
  2091  		a.cur.replacer = replacer
  2092  		a.cur.parent = parent
  2093  		a.cur.node = node
  2094  		if !a.pre(&a.cur) {
  2095  			return true
  2096  		}
  2097  	}
  2098  	if !a.rewriteTableNames(node, node.TableNames, func(newNode, parent SQLNode) {
  2099  		parent.(*Flush).TableNames = newNode.(TableNames)
  2100  	}) {
  2101  		return false
  2102  	}
  2103  	if a.post != nil {
  2104  		a.cur.replacer = replacer
  2105  		a.cur.parent = parent
  2106  		a.cur.node = node
  2107  		if !a.post(&a.cur) {
  2108  			return false
  2109  		}
  2110  	}
  2111  	return true
  2112  }
  2113  func (a *application) rewriteRefOfForce(parent SQLNode, node *Force, replacer replacerFunc) bool {
  2114  	if node == nil {
  2115  		return true
  2116  	}
  2117  	if a.pre != nil {
  2118  		a.cur.replacer = replacer
  2119  		a.cur.parent = parent
  2120  		a.cur.node = node
  2121  		if !a.pre(&a.cur) {
  2122  			return true
  2123  		}
  2124  	}
  2125  	if a.post != nil {
  2126  		if a.pre == nil {
  2127  			a.cur.replacer = replacer
  2128  			a.cur.parent = parent
  2129  			a.cur.node = node
  2130  		}
  2131  		if !a.post(&a.cur) {
  2132  			return false
  2133  		}
  2134  	}
  2135  	return true
  2136  }
  2137  func (a *application) rewriteRefOfForeignKeyDefinition(parent SQLNode, node *ForeignKeyDefinition, replacer replacerFunc) bool {
  2138  	if node == nil {
  2139  		return true
  2140  	}
  2141  	if a.pre != nil {
  2142  		a.cur.replacer = replacer
  2143  		a.cur.parent = parent
  2144  		a.cur.node = node
  2145  		if !a.pre(&a.cur) {
  2146  			return true
  2147  		}
  2148  	}
  2149  	if !a.rewriteColumns(node, node.Source, func(newNode, parent SQLNode) {
  2150  		parent.(*ForeignKeyDefinition).Source = newNode.(Columns)
  2151  	}) {
  2152  		return false
  2153  	}
  2154  	if !a.rewriteColIdent(node, node.IndexName, func(newNode, parent SQLNode) {
  2155  		parent.(*ForeignKeyDefinition).IndexName = newNode.(ColIdent)
  2156  	}) {
  2157  		return false
  2158  	}
  2159  	if !a.rewriteRefOfReferenceDefinition(node, node.ReferenceDefinition, func(newNode, parent SQLNode) {
  2160  		parent.(*ForeignKeyDefinition).ReferenceDefinition = newNode.(*ReferenceDefinition)
  2161  	}) {
  2162  		return false
  2163  	}
  2164  	if a.post != nil {
  2165  		a.cur.replacer = replacer
  2166  		a.cur.parent = parent
  2167  		a.cur.node = node
  2168  		if !a.post(&a.cur) {
  2169  			return false
  2170  		}
  2171  	}
  2172  	return true
  2173  }
  2174  func (a *application) rewriteRefOfFuncExpr(parent SQLNode, node *FuncExpr, replacer replacerFunc) bool {
  2175  	if node == nil {
  2176  		return true
  2177  	}
  2178  	if a.pre != nil {
  2179  		a.cur.replacer = replacer
  2180  		a.cur.parent = parent
  2181  		a.cur.node = node
  2182  		if !a.pre(&a.cur) {
  2183  			return true
  2184  		}
  2185  	}
  2186  	if !a.rewriteTableIdent(node, node.Qualifier, func(newNode, parent SQLNode) {
  2187  		parent.(*FuncExpr).Qualifier = newNode.(TableIdent)
  2188  	}) {
  2189  		return false
  2190  	}
  2191  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  2192  		parent.(*FuncExpr).Name = newNode.(ColIdent)
  2193  	}) {
  2194  		return false
  2195  	}
  2196  	if !a.rewriteSelectExprs(node, node.Exprs, func(newNode, parent SQLNode) {
  2197  		parent.(*FuncExpr).Exprs = newNode.(SelectExprs)
  2198  	}) {
  2199  		return false
  2200  	}
  2201  	if a.post != nil {
  2202  		a.cur.replacer = replacer
  2203  		a.cur.parent = parent
  2204  		a.cur.node = node
  2205  		if !a.post(&a.cur) {
  2206  			return false
  2207  		}
  2208  	}
  2209  	return true
  2210  }
  2211  func (a *application) rewriteGroupBy(parent SQLNode, node GroupBy, replacer replacerFunc) bool {
  2212  	if node == nil {
  2213  		return true
  2214  	}
  2215  	if a.pre != nil {
  2216  		a.cur.replacer = replacer
  2217  		a.cur.parent = parent
  2218  		a.cur.node = node
  2219  		kontinue := !a.pre(&a.cur)
  2220  		if a.cur.revisit {
  2221  			node = a.cur.node.(GroupBy)
  2222  			a.cur.revisit = false
  2223  			return a.rewriteGroupBy(parent, node, replacer)
  2224  		}
  2225  		if kontinue {
  2226  			return true
  2227  		}
  2228  	}
  2229  	for x, el := range node {
  2230  		if !a.rewriteExpr(node, el, func(idx int) replacerFunc {
  2231  			return func(newNode, parent SQLNode) {
  2232  				parent.(GroupBy)[idx] = newNode.(Expr)
  2233  			}
  2234  		}(x)) {
  2235  			return false
  2236  		}
  2237  	}
  2238  	if a.post != nil {
  2239  		a.cur.replacer = replacer
  2240  		a.cur.parent = parent
  2241  		a.cur.node = node
  2242  		if !a.post(&a.cur) {
  2243  			return false
  2244  		}
  2245  	}
  2246  	return true
  2247  }
  2248  func (a *application) rewriteRefOfGroupConcatExpr(parent SQLNode, node *GroupConcatExpr, replacer replacerFunc) bool {
  2249  	if node == nil {
  2250  		return true
  2251  	}
  2252  	if a.pre != nil {
  2253  		a.cur.replacer = replacer
  2254  		a.cur.parent = parent
  2255  		a.cur.node = node
  2256  		if !a.pre(&a.cur) {
  2257  			return true
  2258  		}
  2259  	}
  2260  	if !a.rewriteSelectExprs(node, node.Exprs, func(newNode, parent SQLNode) {
  2261  		parent.(*GroupConcatExpr).Exprs = newNode.(SelectExprs)
  2262  	}) {
  2263  		return false
  2264  	}
  2265  	if !a.rewriteOrderBy(node, node.OrderBy, func(newNode, parent SQLNode) {
  2266  		parent.(*GroupConcatExpr).OrderBy = newNode.(OrderBy)
  2267  	}) {
  2268  		return false
  2269  	}
  2270  	if !a.rewriteRefOfLimit(node, node.Limit, func(newNode, parent SQLNode) {
  2271  		parent.(*GroupConcatExpr).Limit = newNode.(*Limit)
  2272  	}) {
  2273  		return false
  2274  	}
  2275  	if a.post != nil {
  2276  		a.cur.replacer = replacer
  2277  		a.cur.parent = parent
  2278  		a.cur.node = node
  2279  		if !a.post(&a.cur) {
  2280  			return false
  2281  		}
  2282  	}
  2283  	return true
  2284  }
  2285  func (a *application) rewriteRefOfIndexDefinition(parent SQLNode, node *IndexDefinition, replacer replacerFunc) bool {
  2286  	if node == nil {
  2287  		return true
  2288  	}
  2289  	if a.pre != nil {
  2290  		a.cur.replacer = replacer
  2291  		a.cur.parent = parent
  2292  		a.cur.node = node
  2293  		if !a.pre(&a.cur) {
  2294  			return true
  2295  		}
  2296  	}
  2297  	if !a.rewriteRefOfIndexInfo(node, node.Info, func(newNode, parent SQLNode) {
  2298  		parent.(*IndexDefinition).Info = newNode.(*IndexInfo)
  2299  	}) {
  2300  		return false
  2301  	}
  2302  	if a.post != nil {
  2303  		a.cur.replacer = replacer
  2304  		a.cur.parent = parent
  2305  		a.cur.node = node
  2306  		if !a.post(&a.cur) {
  2307  			return false
  2308  		}
  2309  	}
  2310  	return true
  2311  }
  2312  func (a *application) rewriteRefOfIndexHints(parent SQLNode, node *IndexHints, replacer replacerFunc) bool {
  2313  	if node == nil {
  2314  		return true
  2315  	}
  2316  	if a.pre != nil {
  2317  		a.cur.replacer = replacer
  2318  		a.cur.parent = parent
  2319  		a.cur.node = node
  2320  		if !a.pre(&a.cur) {
  2321  			return true
  2322  		}
  2323  	}
  2324  	for x, el := range node.Indexes {
  2325  		if !a.rewriteColIdent(node, el, func(idx int) replacerFunc {
  2326  			return func(newNode, parent SQLNode) {
  2327  				parent.(*IndexHints).Indexes[idx] = newNode.(ColIdent)
  2328  			}
  2329  		}(x)) {
  2330  			return false
  2331  		}
  2332  	}
  2333  	if a.post != nil {
  2334  		a.cur.replacer = replacer
  2335  		a.cur.parent = parent
  2336  		a.cur.node = node
  2337  		if !a.post(&a.cur) {
  2338  			return false
  2339  		}
  2340  	}
  2341  	return true
  2342  }
  2343  func (a *application) rewriteRefOfIndexInfo(parent SQLNode, node *IndexInfo, replacer replacerFunc) bool {
  2344  	if node == nil {
  2345  		return true
  2346  	}
  2347  	if a.pre != nil {
  2348  		a.cur.replacer = replacer
  2349  		a.cur.parent = parent
  2350  		a.cur.node = node
  2351  		if !a.pre(&a.cur) {
  2352  			return true
  2353  		}
  2354  	}
  2355  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  2356  		parent.(*IndexInfo).Name = newNode.(ColIdent)
  2357  	}) {
  2358  		return false
  2359  	}
  2360  	if !a.rewriteColIdent(node, node.ConstraintName, func(newNode, parent SQLNode) {
  2361  		parent.(*IndexInfo).ConstraintName = newNode.(ColIdent)
  2362  	}) {
  2363  		return false
  2364  	}
  2365  	if a.post != nil {
  2366  		a.cur.replacer = replacer
  2367  		a.cur.parent = parent
  2368  		a.cur.node = node
  2369  		if !a.post(&a.cur) {
  2370  			return false
  2371  		}
  2372  	}
  2373  	return true
  2374  }
  2375  func (a *application) rewriteRefOfInsert(parent SQLNode, node *Insert, replacer replacerFunc) bool {
  2376  	if node == nil {
  2377  		return true
  2378  	}
  2379  	if a.pre != nil {
  2380  		a.cur.replacer = replacer
  2381  		a.cur.parent = parent
  2382  		a.cur.node = node
  2383  		if !a.pre(&a.cur) {
  2384  			return true
  2385  		}
  2386  	}
  2387  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  2388  		parent.(*Insert).Comments = newNode.(Comments)
  2389  	}) {
  2390  		return false
  2391  	}
  2392  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  2393  		parent.(*Insert).Table = newNode.(TableName)
  2394  	}) {
  2395  		return false
  2396  	}
  2397  	if !a.rewritePartitions(node, node.Partitions, func(newNode, parent SQLNode) {
  2398  		parent.(*Insert).Partitions = newNode.(Partitions)
  2399  	}) {
  2400  		return false
  2401  	}
  2402  	if !a.rewriteColumns(node, node.Columns, func(newNode, parent SQLNode) {
  2403  		parent.(*Insert).Columns = newNode.(Columns)
  2404  	}) {
  2405  		return false
  2406  	}
  2407  	if !a.rewriteInsertRows(node, node.Rows, func(newNode, parent SQLNode) {
  2408  		parent.(*Insert).Rows = newNode.(InsertRows)
  2409  	}) {
  2410  		return false
  2411  	}
  2412  	if !a.rewriteOnDup(node, node.OnDup, func(newNode, parent SQLNode) {
  2413  		parent.(*Insert).OnDup = newNode.(OnDup)
  2414  	}) {
  2415  		return false
  2416  	}
  2417  	if a.post != nil {
  2418  		a.cur.replacer = replacer
  2419  		a.cur.parent = parent
  2420  		a.cur.node = node
  2421  		if !a.post(&a.cur) {
  2422  			return false
  2423  		}
  2424  	}
  2425  	return true
  2426  }
  2427  func (a *application) rewriteRefOfIntervalExpr(parent SQLNode, node *IntervalExpr, replacer replacerFunc) bool {
  2428  	if node == nil {
  2429  		return true
  2430  	}
  2431  	if a.pre != nil {
  2432  		a.cur.replacer = replacer
  2433  		a.cur.parent = parent
  2434  		a.cur.node = node
  2435  		if !a.pre(&a.cur) {
  2436  			return true
  2437  		}
  2438  	}
  2439  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  2440  		parent.(*IntervalExpr).Expr = newNode.(Expr)
  2441  	}) {
  2442  		return false
  2443  	}
  2444  	if a.post != nil {
  2445  		a.cur.replacer = replacer
  2446  		a.cur.parent = parent
  2447  		a.cur.node = node
  2448  		if !a.post(&a.cur) {
  2449  			return false
  2450  		}
  2451  	}
  2452  	return true
  2453  }
  2454  func (a *application) rewriteRefOfIntroducerExpr(parent SQLNode, node *IntroducerExpr, replacer replacerFunc) bool {
  2455  	if node == nil {
  2456  		return true
  2457  	}
  2458  	if a.pre != nil {
  2459  		a.cur.replacer = replacer
  2460  		a.cur.parent = parent
  2461  		a.cur.node = node
  2462  		if !a.pre(&a.cur) {
  2463  			return true
  2464  		}
  2465  	}
  2466  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  2467  		parent.(*IntroducerExpr).Expr = newNode.(Expr)
  2468  	}) {
  2469  		return false
  2470  	}
  2471  	if a.post != nil {
  2472  		a.cur.replacer = replacer
  2473  		a.cur.parent = parent
  2474  		a.cur.node = node
  2475  		if !a.post(&a.cur) {
  2476  			return false
  2477  		}
  2478  	}
  2479  	return true
  2480  }
  2481  func (a *application) rewriteRefOfIsExpr(parent SQLNode, node *IsExpr, replacer replacerFunc) bool {
  2482  	if node == nil {
  2483  		return true
  2484  	}
  2485  	if a.pre != nil {
  2486  		a.cur.replacer = replacer
  2487  		a.cur.parent = parent
  2488  		a.cur.node = node
  2489  		if !a.pre(&a.cur) {
  2490  			return true
  2491  		}
  2492  	}
  2493  	if !a.rewriteExpr(node, node.Left, func(newNode, parent SQLNode) {
  2494  		parent.(*IsExpr).Left = newNode.(Expr)
  2495  	}) {
  2496  		return false
  2497  	}
  2498  	if a.post != nil {
  2499  		a.cur.replacer = replacer
  2500  		a.cur.parent = parent
  2501  		a.cur.node = node
  2502  		if !a.post(&a.cur) {
  2503  			return false
  2504  		}
  2505  	}
  2506  	return true
  2507  }
  2508  func (a *application) rewriteRefOfJoinCondition(parent SQLNode, node *JoinCondition, replacer replacerFunc) bool {
  2509  	if node == nil {
  2510  		return true
  2511  	}
  2512  	if a.pre != nil {
  2513  		a.cur.replacer = replacer
  2514  		a.cur.parent = parent
  2515  		a.cur.node = node
  2516  		if !a.pre(&a.cur) {
  2517  			return true
  2518  		}
  2519  	}
  2520  	if !a.rewriteExpr(node, node.On, func(newNode, parent SQLNode) {
  2521  		parent.(*JoinCondition).On = newNode.(Expr)
  2522  	}) {
  2523  		return false
  2524  	}
  2525  	if !a.rewriteColumns(node, node.Using, func(newNode, parent SQLNode) {
  2526  		parent.(*JoinCondition).Using = newNode.(Columns)
  2527  	}) {
  2528  		return false
  2529  	}
  2530  	if a.post != nil {
  2531  		a.cur.replacer = replacer
  2532  		a.cur.parent = parent
  2533  		a.cur.node = node
  2534  		if !a.post(&a.cur) {
  2535  			return false
  2536  		}
  2537  	}
  2538  	return true
  2539  }
  2540  func (a *application) rewriteRefOfJoinTableExpr(parent SQLNode, node *JoinTableExpr, replacer replacerFunc) bool {
  2541  	if node == nil {
  2542  		return true
  2543  	}
  2544  	if a.pre != nil {
  2545  		a.cur.replacer = replacer
  2546  		a.cur.parent = parent
  2547  		a.cur.node = node
  2548  		if !a.pre(&a.cur) {
  2549  			return true
  2550  		}
  2551  	}
  2552  	if !a.rewriteTableExpr(node, node.LeftExpr, func(newNode, parent SQLNode) {
  2553  		parent.(*JoinTableExpr).LeftExpr = newNode.(TableExpr)
  2554  	}) {
  2555  		return false
  2556  	}
  2557  	if !a.rewriteTableExpr(node, node.RightExpr, func(newNode, parent SQLNode) {
  2558  		parent.(*JoinTableExpr).RightExpr = newNode.(TableExpr)
  2559  	}) {
  2560  		return false
  2561  	}
  2562  	if !a.rewriteRefOfJoinCondition(node, node.Condition, func(newNode, parent SQLNode) {
  2563  		parent.(*JoinTableExpr).Condition = newNode.(*JoinCondition)
  2564  	}) {
  2565  		return false
  2566  	}
  2567  	if a.post != nil {
  2568  		a.cur.replacer = replacer
  2569  		a.cur.parent = parent
  2570  		a.cur.node = node
  2571  		if !a.post(&a.cur) {
  2572  			return false
  2573  		}
  2574  	}
  2575  	return true
  2576  }
  2577  func (a *application) rewriteRefOfKeyState(parent SQLNode, node *KeyState, replacer replacerFunc) bool {
  2578  	if node == nil {
  2579  		return true
  2580  	}
  2581  	if a.pre != nil {
  2582  		a.cur.replacer = replacer
  2583  		a.cur.parent = parent
  2584  		a.cur.node = node
  2585  		if !a.pre(&a.cur) {
  2586  			return true
  2587  		}
  2588  	}
  2589  	if a.post != nil {
  2590  		if a.pre == nil {
  2591  			a.cur.replacer = replacer
  2592  			a.cur.parent = parent
  2593  			a.cur.node = node
  2594  		}
  2595  		if !a.post(&a.cur) {
  2596  			return false
  2597  		}
  2598  	}
  2599  	return true
  2600  }
  2601  func (a *application) rewriteRefOfLimit(parent SQLNode, node *Limit, replacer replacerFunc) bool {
  2602  	if node == nil {
  2603  		return true
  2604  	}
  2605  	if a.pre != nil {
  2606  		a.cur.replacer = replacer
  2607  		a.cur.parent = parent
  2608  		a.cur.node = node
  2609  		if !a.pre(&a.cur) {
  2610  			return true
  2611  		}
  2612  	}
  2613  	if !a.rewriteExpr(node, node.Offset, func(newNode, parent SQLNode) {
  2614  		parent.(*Limit).Offset = newNode.(Expr)
  2615  	}) {
  2616  		return false
  2617  	}
  2618  	if !a.rewriteExpr(node, node.Rowcount, func(newNode, parent SQLNode) {
  2619  		parent.(*Limit).Rowcount = newNode.(Expr)
  2620  	}) {
  2621  		return false
  2622  	}
  2623  	if a.post != nil {
  2624  		a.cur.replacer = replacer
  2625  		a.cur.parent = parent
  2626  		a.cur.node = node
  2627  		if !a.post(&a.cur) {
  2628  			return false
  2629  		}
  2630  	}
  2631  	return true
  2632  }
  2633  func (a *application) rewriteRefOfLiteral(parent SQLNode, node *Literal, replacer replacerFunc) bool {
  2634  	if node == nil {
  2635  		return true
  2636  	}
  2637  	if a.pre != nil {
  2638  		a.cur.replacer = replacer
  2639  		a.cur.parent = parent
  2640  		a.cur.node = node
  2641  		if !a.pre(&a.cur) {
  2642  			return true
  2643  		}
  2644  	}
  2645  	if a.post != nil {
  2646  		if a.pre == nil {
  2647  			a.cur.replacer = replacer
  2648  			a.cur.parent = parent
  2649  			a.cur.node = node
  2650  		}
  2651  		if !a.post(&a.cur) {
  2652  			return false
  2653  		}
  2654  	}
  2655  	return true
  2656  }
  2657  func (a *application) rewriteRefOfLoad(parent SQLNode, node *Load, replacer replacerFunc) bool {
  2658  	if node == nil {
  2659  		return true
  2660  	}
  2661  	if a.pre != nil {
  2662  		a.cur.replacer = replacer
  2663  		a.cur.parent = parent
  2664  		a.cur.node = node
  2665  		if !a.pre(&a.cur) {
  2666  			return true
  2667  		}
  2668  	}
  2669  	if a.post != nil {
  2670  		if a.pre == nil {
  2671  			a.cur.replacer = replacer
  2672  			a.cur.parent = parent
  2673  			a.cur.node = node
  2674  		}
  2675  		if !a.post(&a.cur) {
  2676  			return false
  2677  		}
  2678  	}
  2679  	return true
  2680  }
  2681  func (a *application) rewriteRefOfLockOption(parent SQLNode, node *LockOption, replacer replacerFunc) bool {
  2682  	if node == nil {
  2683  		return true
  2684  	}
  2685  	if a.pre != nil {
  2686  		a.cur.replacer = replacer
  2687  		a.cur.parent = parent
  2688  		a.cur.node = node
  2689  		if !a.pre(&a.cur) {
  2690  			return true
  2691  		}
  2692  	}
  2693  	if a.post != nil {
  2694  		if a.pre == nil {
  2695  			a.cur.replacer = replacer
  2696  			a.cur.parent = parent
  2697  			a.cur.node = node
  2698  		}
  2699  		if !a.post(&a.cur) {
  2700  			return false
  2701  		}
  2702  	}
  2703  	return true
  2704  }
  2705  func (a *application) rewriteRefOfLockTables(parent SQLNode, node *LockTables, replacer replacerFunc) bool {
  2706  	if node == nil {
  2707  		return true
  2708  	}
  2709  	if a.pre != nil {
  2710  		a.cur.replacer = replacer
  2711  		a.cur.parent = parent
  2712  		a.cur.node = node
  2713  		if !a.pre(&a.cur) {
  2714  			return true
  2715  		}
  2716  	}
  2717  	if a.post != nil {
  2718  		if a.pre == nil {
  2719  			a.cur.replacer = replacer
  2720  			a.cur.parent = parent
  2721  			a.cur.node = node
  2722  		}
  2723  		if !a.post(&a.cur) {
  2724  			return false
  2725  		}
  2726  	}
  2727  	return true
  2728  }
  2729  func (a *application) rewriteRefOfMatchExpr(parent SQLNode, node *MatchExpr, replacer replacerFunc) bool {
  2730  	if node == nil {
  2731  		return true
  2732  	}
  2733  	if a.pre != nil {
  2734  		a.cur.replacer = replacer
  2735  		a.cur.parent = parent
  2736  		a.cur.node = node
  2737  		if !a.pre(&a.cur) {
  2738  			return true
  2739  		}
  2740  	}
  2741  	if !a.rewriteSelectExprs(node, node.Columns, func(newNode, parent SQLNode) {
  2742  		parent.(*MatchExpr).Columns = newNode.(SelectExprs)
  2743  	}) {
  2744  		return false
  2745  	}
  2746  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  2747  		parent.(*MatchExpr).Expr = newNode.(Expr)
  2748  	}) {
  2749  		return false
  2750  	}
  2751  	if a.post != nil {
  2752  		a.cur.replacer = replacer
  2753  		a.cur.parent = parent
  2754  		a.cur.node = node
  2755  		if !a.post(&a.cur) {
  2756  			return false
  2757  		}
  2758  	}
  2759  	return true
  2760  }
  2761  func (a *application) rewriteRefOfModifyColumn(parent SQLNode, node *ModifyColumn, replacer replacerFunc) bool {
  2762  	if node == nil {
  2763  		return true
  2764  	}
  2765  	if a.pre != nil {
  2766  		a.cur.replacer = replacer
  2767  		a.cur.parent = parent
  2768  		a.cur.node = node
  2769  		if !a.pre(&a.cur) {
  2770  			return true
  2771  		}
  2772  	}
  2773  	if !a.rewriteRefOfColumnDefinition(node, node.NewColDefinition, func(newNode, parent SQLNode) {
  2774  		parent.(*ModifyColumn).NewColDefinition = newNode.(*ColumnDefinition)
  2775  	}) {
  2776  		return false
  2777  	}
  2778  	if !a.rewriteRefOfColName(node, node.After, func(newNode, parent SQLNode) {
  2779  		parent.(*ModifyColumn).After = newNode.(*ColName)
  2780  	}) {
  2781  		return false
  2782  	}
  2783  	if a.post != nil {
  2784  		a.cur.replacer = replacer
  2785  		a.cur.parent = parent
  2786  		a.cur.node = node
  2787  		if !a.post(&a.cur) {
  2788  			return false
  2789  		}
  2790  	}
  2791  	return true
  2792  }
  2793  func (a *application) rewriteRefOfNextval(parent SQLNode, node *Nextval, replacer replacerFunc) bool {
  2794  	if node == nil {
  2795  		return true
  2796  	}
  2797  	if a.pre != nil {
  2798  		a.cur.replacer = replacer
  2799  		a.cur.parent = parent
  2800  		a.cur.node = node
  2801  		if !a.pre(&a.cur) {
  2802  			return true
  2803  		}
  2804  	}
  2805  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  2806  		parent.(*Nextval).Expr = newNode.(Expr)
  2807  	}) {
  2808  		return false
  2809  	}
  2810  	if a.post != nil {
  2811  		a.cur.replacer = replacer
  2812  		a.cur.parent = parent
  2813  		a.cur.node = node
  2814  		if !a.post(&a.cur) {
  2815  			return false
  2816  		}
  2817  	}
  2818  	return true
  2819  }
  2820  func (a *application) rewriteRefOfNotExpr(parent SQLNode, node *NotExpr, replacer replacerFunc) bool {
  2821  	if node == nil {
  2822  		return true
  2823  	}
  2824  	if a.pre != nil {
  2825  		a.cur.replacer = replacer
  2826  		a.cur.parent = parent
  2827  		a.cur.node = node
  2828  		if !a.pre(&a.cur) {
  2829  			return true
  2830  		}
  2831  	}
  2832  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  2833  		parent.(*NotExpr).Expr = newNode.(Expr)
  2834  	}) {
  2835  		return false
  2836  	}
  2837  	if a.post != nil {
  2838  		a.cur.replacer = replacer
  2839  		a.cur.parent = parent
  2840  		a.cur.node = node
  2841  		if !a.post(&a.cur) {
  2842  			return false
  2843  		}
  2844  	}
  2845  	return true
  2846  }
  2847  func (a *application) rewriteRefOfNullVal(parent SQLNode, node *NullVal, replacer replacerFunc) bool {
  2848  	if node == nil {
  2849  		return true
  2850  	}
  2851  	if a.pre != nil {
  2852  		a.cur.replacer = replacer
  2853  		a.cur.parent = parent
  2854  		a.cur.node = node
  2855  		if !a.pre(&a.cur) {
  2856  			return true
  2857  		}
  2858  	}
  2859  	if a.post != nil {
  2860  		if a.pre == nil {
  2861  			a.cur.replacer = replacer
  2862  			a.cur.parent = parent
  2863  			a.cur.node = node
  2864  		}
  2865  		if !a.post(&a.cur) {
  2866  			return false
  2867  		}
  2868  	}
  2869  	return true
  2870  }
  2871  func (a *application) rewriteOnDup(parent SQLNode, node OnDup, replacer replacerFunc) bool {
  2872  	if node == nil {
  2873  		return true
  2874  	}
  2875  	if a.pre != nil {
  2876  		a.cur.replacer = replacer
  2877  		a.cur.parent = parent
  2878  		a.cur.node = node
  2879  		kontinue := !a.pre(&a.cur)
  2880  		if a.cur.revisit {
  2881  			node = a.cur.node.(OnDup)
  2882  			a.cur.revisit = false
  2883  			return a.rewriteOnDup(parent, node, replacer)
  2884  		}
  2885  		if kontinue {
  2886  			return true
  2887  		}
  2888  	}
  2889  	for x, el := range node {
  2890  		if !a.rewriteRefOfUpdateExpr(node, el, func(idx int) replacerFunc {
  2891  			return func(newNode, parent SQLNode) {
  2892  				parent.(OnDup)[idx] = newNode.(*UpdateExpr)
  2893  			}
  2894  		}(x)) {
  2895  			return false
  2896  		}
  2897  	}
  2898  	if a.post != nil {
  2899  		a.cur.replacer = replacer
  2900  		a.cur.parent = parent
  2901  		a.cur.node = node
  2902  		if !a.post(&a.cur) {
  2903  			return false
  2904  		}
  2905  	}
  2906  	return true
  2907  }
  2908  func (a *application) rewriteRefOfOptLike(parent SQLNode, node *OptLike, replacer replacerFunc) bool {
  2909  	if node == nil {
  2910  		return true
  2911  	}
  2912  	if a.pre != nil {
  2913  		a.cur.replacer = replacer
  2914  		a.cur.parent = parent
  2915  		a.cur.node = node
  2916  		if !a.pre(&a.cur) {
  2917  			return true
  2918  		}
  2919  	}
  2920  	if !a.rewriteTableName(node, node.LikeTable, func(newNode, parent SQLNode) {
  2921  		parent.(*OptLike).LikeTable = newNode.(TableName)
  2922  	}) {
  2923  		return false
  2924  	}
  2925  	if a.post != nil {
  2926  		a.cur.replacer = replacer
  2927  		a.cur.parent = parent
  2928  		a.cur.node = node
  2929  		if !a.post(&a.cur) {
  2930  			return false
  2931  		}
  2932  	}
  2933  	return true
  2934  }
  2935  func (a *application) rewriteRefOfOrExpr(parent SQLNode, node *OrExpr, replacer replacerFunc) bool {
  2936  	if node == nil {
  2937  		return true
  2938  	}
  2939  	if a.pre != nil {
  2940  		a.cur.replacer = replacer
  2941  		a.cur.parent = parent
  2942  		a.cur.node = node
  2943  		if !a.pre(&a.cur) {
  2944  			return true
  2945  		}
  2946  	}
  2947  	if !a.rewriteExpr(node, node.Left, func(newNode, parent SQLNode) {
  2948  		parent.(*OrExpr).Left = newNode.(Expr)
  2949  	}) {
  2950  		return false
  2951  	}
  2952  	if !a.rewriteExpr(node, node.Right, func(newNode, parent SQLNode) {
  2953  		parent.(*OrExpr).Right = newNode.(Expr)
  2954  	}) {
  2955  		return false
  2956  	}
  2957  	if a.post != nil {
  2958  		a.cur.replacer = replacer
  2959  		a.cur.parent = parent
  2960  		a.cur.node = node
  2961  		if !a.post(&a.cur) {
  2962  			return false
  2963  		}
  2964  	}
  2965  	return true
  2966  }
  2967  func (a *application) rewriteRefOfOrder(parent SQLNode, node *Order, replacer replacerFunc) bool {
  2968  	if node == nil {
  2969  		return true
  2970  	}
  2971  	if a.pre != nil {
  2972  		a.cur.replacer = replacer
  2973  		a.cur.parent = parent
  2974  		a.cur.node = node
  2975  		if !a.pre(&a.cur) {
  2976  			return true
  2977  		}
  2978  	}
  2979  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  2980  		parent.(*Order).Expr = newNode.(Expr)
  2981  	}) {
  2982  		return false
  2983  	}
  2984  	if a.post != nil {
  2985  		a.cur.replacer = replacer
  2986  		a.cur.parent = parent
  2987  		a.cur.node = node
  2988  		if !a.post(&a.cur) {
  2989  			return false
  2990  		}
  2991  	}
  2992  	return true
  2993  }
  2994  func (a *application) rewriteOrderBy(parent SQLNode, node OrderBy, replacer replacerFunc) bool {
  2995  	if node == nil {
  2996  		return true
  2997  	}
  2998  	if a.pre != nil {
  2999  		a.cur.replacer = replacer
  3000  		a.cur.parent = parent
  3001  		a.cur.node = node
  3002  		kontinue := !a.pre(&a.cur)
  3003  		if a.cur.revisit {
  3004  			node = a.cur.node.(OrderBy)
  3005  			a.cur.revisit = false
  3006  			return a.rewriteOrderBy(parent, node, replacer)
  3007  		}
  3008  		if kontinue {
  3009  			return true
  3010  		}
  3011  	}
  3012  	for x, el := range node {
  3013  		if !a.rewriteRefOfOrder(node, el, func(idx int) replacerFunc {
  3014  			return func(newNode, parent SQLNode) {
  3015  				parent.(OrderBy)[idx] = newNode.(*Order)
  3016  			}
  3017  		}(x)) {
  3018  			return false
  3019  		}
  3020  	}
  3021  	if a.post != nil {
  3022  		a.cur.replacer = replacer
  3023  		a.cur.parent = parent
  3024  		a.cur.node = node
  3025  		if !a.post(&a.cur) {
  3026  			return false
  3027  		}
  3028  	}
  3029  	return true
  3030  }
  3031  func (a *application) rewriteRefOfOrderByOption(parent SQLNode, node *OrderByOption, replacer replacerFunc) bool {
  3032  	if node == nil {
  3033  		return true
  3034  	}
  3035  	if a.pre != nil {
  3036  		a.cur.replacer = replacer
  3037  		a.cur.parent = parent
  3038  		a.cur.node = node
  3039  		if !a.pre(&a.cur) {
  3040  			return true
  3041  		}
  3042  	}
  3043  	if !a.rewriteColumns(node, node.Cols, func(newNode, parent SQLNode) {
  3044  		parent.(*OrderByOption).Cols = newNode.(Columns)
  3045  	}) {
  3046  		return false
  3047  	}
  3048  	if a.post != nil {
  3049  		a.cur.replacer = replacer
  3050  		a.cur.parent = parent
  3051  		a.cur.node = node
  3052  		if !a.post(&a.cur) {
  3053  			return false
  3054  		}
  3055  	}
  3056  	return true
  3057  }
  3058  func (a *application) rewriteRefOfOtherAdmin(parent SQLNode, node *OtherAdmin, replacer replacerFunc) bool {
  3059  	if node == nil {
  3060  		return true
  3061  	}
  3062  	if a.pre != nil {
  3063  		a.cur.replacer = replacer
  3064  		a.cur.parent = parent
  3065  		a.cur.node = node
  3066  		if !a.pre(&a.cur) {
  3067  			return true
  3068  		}
  3069  	}
  3070  	if a.post != nil {
  3071  		if a.pre == nil {
  3072  			a.cur.replacer = replacer
  3073  			a.cur.parent = parent
  3074  			a.cur.node = node
  3075  		}
  3076  		if !a.post(&a.cur) {
  3077  			return false
  3078  		}
  3079  	}
  3080  	return true
  3081  }
  3082  func (a *application) rewriteRefOfOtherRead(parent SQLNode, node *OtherRead, replacer replacerFunc) bool {
  3083  	if node == nil {
  3084  		return true
  3085  	}
  3086  	if a.pre != nil {
  3087  		a.cur.replacer = replacer
  3088  		a.cur.parent = parent
  3089  		a.cur.node = node
  3090  		if !a.pre(&a.cur) {
  3091  			return true
  3092  		}
  3093  	}
  3094  	if a.post != nil {
  3095  		if a.pre == nil {
  3096  			a.cur.replacer = replacer
  3097  			a.cur.parent = parent
  3098  			a.cur.node = node
  3099  		}
  3100  		if !a.post(&a.cur) {
  3101  			return false
  3102  		}
  3103  	}
  3104  	return true
  3105  }
  3106  func (a *application) rewriteRefOfParenTableExpr(parent SQLNode, node *ParenTableExpr, replacer replacerFunc) bool {
  3107  	if node == nil {
  3108  		return true
  3109  	}
  3110  	if a.pre != nil {
  3111  		a.cur.replacer = replacer
  3112  		a.cur.parent = parent
  3113  		a.cur.node = node
  3114  		if !a.pre(&a.cur) {
  3115  			return true
  3116  		}
  3117  	}
  3118  	if !a.rewriteTableExprs(node, node.Exprs, func(newNode, parent SQLNode) {
  3119  		parent.(*ParenTableExpr).Exprs = newNode.(TableExprs)
  3120  	}) {
  3121  		return false
  3122  	}
  3123  	if a.post != nil {
  3124  		a.cur.replacer = replacer
  3125  		a.cur.parent = parent
  3126  		a.cur.node = node
  3127  		if !a.post(&a.cur) {
  3128  			return false
  3129  		}
  3130  	}
  3131  	return true
  3132  }
  3133  func (a *application) rewriteRefOfPartitionDefinition(parent SQLNode, node *PartitionDefinition, replacer replacerFunc) bool {
  3134  	if node == nil {
  3135  		return true
  3136  	}
  3137  	if a.pre != nil {
  3138  		a.cur.replacer = replacer
  3139  		a.cur.parent = parent
  3140  		a.cur.node = node
  3141  		if !a.pre(&a.cur) {
  3142  			return true
  3143  		}
  3144  	}
  3145  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  3146  		parent.(*PartitionDefinition).Name = newNode.(ColIdent)
  3147  	}) {
  3148  		return false
  3149  	}
  3150  	if !a.rewriteExpr(node, node.Limit, func(newNode, parent SQLNode) {
  3151  		parent.(*PartitionDefinition).Limit = newNode.(Expr)
  3152  	}) {
  3153  		return false
  3154  	}
  3155  	if a.post != nil {
  3156  		a.cur.replacer = replacer
  3157  		a.cur.parent = parent
  3158  		a.cur.node = node
  3159  		if !a.post(&a.cur) {
  3160  			return false
  3161  		}
  3162  	}
  3163  	return true
  3164  }
  3165  func (a *application) rewriteRefOfPartitionOption(parent SQLNode, node *PartitionOption, replacer replacerFunc) bool {
  3166  	if node == nil {
  3167  		return true
  3168  	}
  3169  	if a.pre != nil {
  3170  		a.cur.replacer = replacer
  3171  		a.cur.parent = parent
  3172  		a.cur.node = node
  3173  		if !a.pre(&a.cur) {
  3174  			return true
  3175  		}
  3176  	}
  3177  	if !a.rewriteColumns(node, node.KeyColList, func(newNode, parent SQLNode) {
  3178  		parent.(*PartitionOption).KeyColList = newNode.(Columns)
  3179  	}) {
  3180  		return false
  3181  	}
  3182  	if !a.rewriteRefOfExprOrColumns(node, node.ExprOrCol, func(newNode, parent SQLNode) {
  3183  		parent.(*PartitionOption).ExprOrCol = newNode.(*ExprOrColumns)
  3184  	}) {
  3185  		return false
  3186  	}
  3187  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  3188  		parent.(*PartitionOption).Expr = newNode.(Expr)
  3189  	}) {
  3190  		return false
  3191  	}
  3192  	if !a.rewriteRefOfSubPartition(node, node.SubPartition, func(newNode, parent SQLNode) {
  3193  		parent.(*PartitionOption).SubPartition = newNode.(*SubPartition)
  3194  	}) {
  3195  		return false
  3196  	}
  3197  	for x, el := range node.Definitions {
  3198  		if !a.rewriteRefOfPartitionDefinition(node, el, func(idx int) replacerFunc {
  3199  			return func(newNode, parent SQLNode) {
  3200  				parent.(*PartitionOption).Definitions[idx] = newNode.(*PartitionDefinition)
  3201  			}
  3202  		}(x)) {
  3203  			return false
  3204  		}
  3205  	}
  3206  	if a.post != nil {
  3207  		a.cur.replacer = replacer
  3208  		a.cur.parent = parent
  3209  		a.cur.node = node
  3210  		if !a.post(&a.cur) {
  3211  			return false
  3212  		}
  3213  	}
  3214  	return true
  3215  }
  3216  func (a *application) rewriteRefOfPartitionSpec(parent SQLNode, node *PartitionSpec, replacer replacerFunc) bool {
  3217  	if node == nil {
  3218  		return true
  3219  	}
  3220  	if a.pre != nil {
  3221  		a.cur.replacer = replacer
  3222  		a.cur.parent = parent
  3223  		a.cur.node = node
  3224  		if !a.pre(&a.cur) {
  3225  			return true
  3226  		}
  3227  	}
  3228  	if !a.rewritePartitions(node, node.Names, func(newNode, parent SQLNode) {
  3229  		parent.(*PartitionSpec).Names = newNode.(Partitions)
  3230  	}) {
  3231  		return false
  3232  	}
  3233  	if !a.rewriteRefOfLiteral(node, node.Number, func(newNode, parent SQLNode) {
  3234  		parent.(*PartitionSpec).Number = newNode.(*Literal)
  3235  	}) {
  3236  		return false
  3237  	}
  3238  	if !a.rewriteTableName(node, node.TableName, func(newNode, parent SQLNode) {
  3239  		parent.(*PartitionSpec).TableName = newNode.(TableName)
  3240  	}) {
  3241  		return false
  3242  	}
  3243  	for x, el := range node.Definitions {
  3244  		if !a.rewriteRefOfPartitionDefinition(node, el, func(idx int) replacerFunc {
  3245  			return func(newNode, parent SQLNode) {
  3246  				parent.(*PartitionSpec).Definitions[idx] = newNode.(*PartitionDefinition)
  3247  			}
  3248  		}(x)) {
  3249  			return false
  3250  		}
  3251  	}
  3252  	if a.post != nil {
  3253  		a.cur.replacer = replacer
  3254  		a.cur.parent = parent
  3255  		a.cur.node = node
  3256  		if !a.post(&a.cur) {
  3257  			return false
  3258  		}
  3259  	}
  3260  	return true
  3261  }
  3262  func (a *application) rewritePartitions(parent SQLNode, node Partitions, replacer replacerFunc) bool {
  3263  	if node == nil {
  3264  		return true
  3265  	}
  3266  	if a.pre != nil {
  3267  		a.cur.replacer = replacer
  3268  		a.cur.parent = parent
  3269  		a.cur.node = node
  3270  		kontinue := !a.pre(&a.cur)
  3271  		if a.cur.revisit {
  3272  			node = a.cur.node.(Partitions)
  3273  			a.cur.revisit = false
  3274  			return a.rewritePartitions(parent, node, replacer)
  3275  		}
  3276  		if kontinue {
  3277  			return true
  3278  		}
  3279  	}
  3280  	for x, el := range node {
  3281  		if !a.rewriteColIdent(node, el, func(idx int) replacerFunc {
  3282  			return func(newNode, parent SQLNode) {
  3283  				parent.(Partitions)[idx] = newNode.(ColIdent)
  3284  			}
  3285  		}(x)) {
  3286  			return false
  3287  		}
  3288  	}
  3289  	if a.post != nil {
  3290  		a.cur.replacer = replacer
  3291  		a.cur.parent = parent
  3292  		a.cur.node = node
  3293  		if !a.post(&a.cur) {
  3294  			return false
  3295  		}
  3296  	}
  3297  	return true
  3298  }
  3299  func (a *application) rewriteRefOfReferenceDefinition(parent SQLNode, node *ReferenceDefinition, replacer replacerFunc) bool {
  3300  	if node == nil {
  3301  		return true
  3302  	}
  3303  	if a.pre != nil {
  3304  		a.cur.replacer = replacer
  3305  		a.cur.parent = parent
  3306  		a.cur.node = node
  3307  		if !a.pre(&a.cur) {
  3308  			return true
  3309  		}
  3310  	}
  3311  	if !a.rewriteTableName(node, node.ReferencedTable, func(newNode, parent SQLNode) {
  3312  		parent.(*ReferenceDefinition).ReferencedTable = newNode.(TableName)
  3313  	}) {
  3314  		return false
  3315  	}
  3316  	if !a.rewriteColumns(node, node.ReferencedColumns, func(newNode, parent SQLNode) {
  3317  		parent.(*ReferenceDefinition).ReferencedColumns = newNode.(Columns)
  3318  	}) {
  3319  		return false
  3320  	}
  3321  	if !a.rewriteReferenceAction(node, node.OnDelete, func(newNode, parent SQLNode) {
  3322  		parent.(*ReferenceDefinition).OnDelete = newNode.(ReferenceAction)
  3323  	}) {
  3324  		return false
  3325  	}
  3326  	if !a.rewriteReferenceAction(node, node.OnUpdate, func(newNode, parent SQLNode) {
  3327  		parent.(*ReferenceDefinition).OnUpdate = newNode.(ReferenceAction)
  3328  	}) {
  3329  		return false
  3330  	}
  3331  	if a.post != nil {
  3332  		a.cur.replacer = replacer
  3333  		a.cur.parent = parent
  3334  		a.cur.node = node
  3335  		if !a.post(&a.cur) {
  3336  			return false
  3337  		}
  3338  	}
  3339  	return true
  3340  }
  3341  func (a *application) rewriteRefOfRelease(parent SQLNode, node *Release, replacer replacerFunc) bool {
  3342  	if node == nil {
  3343  		return true
  3344  	}
  3345  	if a.pre != nil {
  3346  		a.cur.replacer = replacer
  3347  		a.cur.parent = parent
  3348  		a.cur.node = node
  3349  		if !a.pre(&a.cur) {
  3350  			return true
  3351  		}
  3352  	}
  3353  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  3354  		parent.(*Release).Name = newNode.(ColIdent)
  3355  	}) {
  3356  		return false
  3357  	}
  3358  	if a.post != nil {
  3359  		a.cur.replacer = replacer
  3360  		a.cur.parent = parent
  3361  		a.cur.node = node
  3362  		if !a.post(&a.cur) {
  3363  			return false
  3364  		}
  3365  	}
  3366  	return true
  3367  }
  3368  func (a *application) rewriteRefOfRenameIndex(parent SQLNode, node *RenameIndex, replacer replacerFunc) bool {
  3369  	if node == nil {
  3370  		return true
  3371  	}
  3372  	if a.pre != nil {
  3373  		a.cur.replacer = replacer
  3374  		a.cur.parent = parent
  3375  		a.cur.node = node
  3376  		if !a.pre(&a.cur) {
  3377  			return true
  3378  		}
  3379  	}
  3380  	if !a.rewriteColIdent(node, node.OldName, func(newNode, parent SQLNode) {
  3381  		parent.(*RenameIndex).OldName = newNode.(ColIdent)
  3382  	}) {
  3383  		return false
  3384  	}
  3385  	if !a.rewriteColIdent(node, node.NewName, func(newNode, parent SQLNode) {
  3386  		parent.(*RenameIndex).NewName = newNode.(ColIdent)
  3387  	}) {
  3388  		return false
  3389  	}
  3390  	if a.post != nil {
  3391  		a.cur.replacer = replacer
  3392  		a.cur.parent = parent
  3393  		a.cur.node = node
  3394  		if !a.post(&a.cur) {
  3395  			return false
  3396  		}
  3397  	}
  3398  	return true
  3399  }
  3400  func (a *application) rewriteRefOfRenameTable(parent SQLNode, node *RenameTable, replacer replacerFunc) bool {
  3401  	if node == nil {
  3402  		return true
  3403  	}
  3404  	if a.pre != nil {
  3405  		a.cur.replacer = replacer
  3406  		a.cur.parent = parent
  3407  		a.cur.node = node
  3408  		if !a.pre(&a.cur) {
  3409  			return true
  3410  		}
  3411  	}
  3412  	if a.post != nil {
  3413  		if a.pre == nil {
  3414  			a.cur.replacer = replacer
  3415  			a.cur.parent = parent
  3416  			a.cur.node = node
  3417  		}
  3418  		if !a.post(&a.cur) {
  3419  			return false
  3420  		}
  3421  	}
  3422  	return true
  3423  }
  3424  func (a *application) rewriteRefOfRenameTableName(parent SQLNode, node *RenameTableName, replacer replacerFunc) bool {
  3425  	if node == nil {
  3426  		return true
  3427  	}
  3428  	if a.pre != nil {
  3429  		a.cur.replacer = replacer
  3430  		a.cur.parent = parent
  3431  		a.cur.node = node
  3432  		if !a.pre(&a.cur) {
  3433  			return true
  3434  		}
  3435  	}
  3436  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  3437  		parent.(*RenameTableName).Table = newNode.(TableName)
  3438  	}) {
  3439  		return false
  3440  	}
  3441  	if a.post != nil {
  3442  		a.cur.replacer = replacer
  3443  		a.cur.parent = parent
  3444  		a.cur.node = node
  3445  		if !a.post(&a.cur) {
  3446  			return false
  3447  		}
  3448  	}
  3449  	return true
  3450  }
  3451  func (a *application) rewriteRefOfRevertMigration(parent SQLNode, node *RevertMigration, replacer replacerFunc) bool {
  3452  	if node == nil {
  3453  		return true
  3454  	}
  3455  	if a.pre != nil {
  3456  		a.cur.replacer = replacer
  3457  		a.cur.parent = parent
  3458  		a.cur.node = node
  3459  		if !a.pre(&a.cur) {
  3460  			return true
  3461  		}
  3462  	}
  3463  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  3464  		parent.(*RevertMigration).Comments = newNode.(Comments)
  3465  	}) {
  3466  		return false
  3467  	}
  3468  	if a.post != nil {
  3469  		a.cur.replacer = replacer
  3470  		a.cur.parent = parent
  3471  		a.cur.node = node
  3472  		if !a.post(&a.cur) {
  3473  			return false
  3474  		}
  3475  	}
  3476  	return true
  3477  }
  3478  func (a *application) rewriteRefOfRollback(parent SQLNode, node *Rollback, replacer replacerFunc) bool {
  3479  	if node == nil {
  3480  		return true
  3481  	}
  3482  	if a.pre != nil {
  3483  		a.cur.replacer = replacer
  3484  		a.cur.parent = parent
  3485  		a.cur.node = node
  3486  		if !a.pre(&a.cur) {
  3487  			return true
  3488  		}
  3489  	}
  3490  	if a.post != nil {
  3491  		if a.pre == nil {
  3492  			a.cur.replacer = replacer
  3493  			a.cur.parent = parent
  3494  			a.cur.node = node
  3495  		}
  3496  		if !a.post(&a.cur) {
  3497  			return false
  3498  		}
  3499  	}
  3500  	return true
  3501  }
  3502  func (a *application) rewriteRootNode(parent SQLNode, node RootNode, replacer replacerFunc) bool {
  3503  	if a.pre != nil {
  3504  		a.cur.replacer = replacer
  3505  		a.cur.parent = parent
  3506  		a.cur.node = node
  3507  		if !a.pre(&a.cur) {
  3508  			return true
  3509  		}
  3510  	}
  3511  	if !a.rewriteSQLNode(node, node.SQLNode, func(newNode, parent SQLNode) {
  3512  		panic("[BUG] tried to replace 'SQLNode' on 'RootNode'")
  3513  	}) {
  3514  		return false
  3515  	}
  3516  	if a.post != nil {
  3517  		a.cur.replacer = replacer
  3518  		a.cur.parent = parent
  3519  		a.cur.node = node
  3520  		if !a.post(&a.cur) {
  3521  			return false
  3522  		}
  3523  	}
  3524  	return true
  3525  }
  3526  func (a *application) rewriteRefOfSRollback(parent SQLNode, node *SRollback, replacer replacerFunc) bool {
  3527  	if node == nil {
  3528  		return true
  3529  	}
  3530  	if a.pre != nil {
  3531  		a.cur.replacer = replacer
  3532  		a.cur.parent = parent
  3533  		a.cur.node = node
  3534  		if !a.pre(&a.cur) {
  3535  			return true
  3536  		}
  3537  	}
  3538  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  3539  		parent.(*SRollback).Name = newNode.(ColIdent)
  3540  	}) {
  3541  		return false
  3542  	}
  3543  	if a.post != nil {
  3544  		a.cur.replacer = replacer
  3545  		a.cur.parent = parent
  3546  		a.cur.node = node
  3547  		if !a.post(&a.cur) {
  3548  			return false
  3549  		}
  3550  	}
  3551  	return true
  3552  }
  3553  func (a *application) rewriteRefOfSavepoint(parent SQLNode, node *Savepoint, replacer replacerFunc) bool {
  3554  	if node == nil {
  3555  		return true
  3556  	}
  3557  	if a.pre != nil {
  3558  		a.cur.replacer = replacer
  3559  		a.cur.parent = parent
  3560  		a.cur.node = node
  3561  		if !a.pre(&a.cur) {
  3562  			return true
  3563  		}
  3564  	}
  3565  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  3566  		parent.(*Savepoint).Name = newNode.(ColIdent)
  3567  	}) {
  3568  		return false
  3569  	}
  3570  	if a.post != nil {
  3571  		a.cur.replacer = replacer
  3572  		a.cur.parent = parent
  3573  		a.cur.node = node
  3574  		if !a.post(&a.cur) {
  3575  			return false
  3576  		}
  3577  	}
  3578  	return true
  3579  }
  3580  func (a *application) rewriteRefOfSelect(parent SQLNode, node *Select, replacer replacerFunc) bool {
  3581  	if node == nil {
  3582  		return true
  3583  	}
  3584  	if a.pre != nil {
  3585  		a.cur.replacer = replacer
  3586  		a.cur.parent = parent
  3587  		a.cur.node = node
  3588  		if !a.pre(&a.cur) {
  3589  			return true
  3590  		}
  3591  	}
  3592  	for x, el := range node.From {
  3593  		if !a.rewriteTableExpr(node, el, func(idx int) replacerFunc {
  3594  			return func(newNode, parent SQLNode) {
  3595  				parent.(*Select).From[idx] = newNode.(TableExpr)
  3596  			}
  3597  		}(x)) {
  3598  			return false
  3599  		}
  3600  	}
  3601  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  3602  		parent.(*Select).Comments = newNode.(Comments)
  3603  	}) {
  3604  		return false
  3605  	}
  3606  	if !a.rewriteSelectExprs(node, node.SelectExprs, func(newNode, parent SQLNode) {
  3607  		parent.(*Select).SelectExprs = newNode.(SelectExprs)
  3608  	}) {
  3609  		return false
  3610  	}
  3611  	if !a.rewriteRefOfWhere(node, node.Where, func(newNode, parent SQLNode) {
  3612  		parent.(*Select).Where = newNode.(*Where)
  3613  	}) {
  3614  		return false
  3615  	}
  3616  	if !a.rewriteRefOfWith(node, node.With, func(newNode, parent SQLNode) {
  3617  		parent.(*Select).With = newNode.(*With)
  3618  	}) {
  3619  		return false
  3620  	}
  3621  	if !a.rewriteGroupBy(node, node.GroupBy, func(newNode, parent SQLNode) {
  3622  		parent.(*Select).GroupBy = newNode.(GroupBy)
  3623  	}) {
  3624  		return false
  3625  	}
  3626  	if !a.rewriteRefOfWhere(node, node.Having, func(newNode, parent SQLNode) {
  3627  		parent.(*Select).Having = newNode.(*Where)
  3628  	}) {
  3629  		return false
  3630  	}
  3631  	if !a.rewriteOrderBy(node, node.OrderBy, func(newNode, parent SQLNode) {
  3632  		parent.(*Select).OrderBy = newNode.(OrderBy)
  3633  	}) {
  3634  		return false
  3635  	}
  3636  	if !a.rewriteRefOfLimit(node, node.Limit, func(newNode, parent SQLNode) {
  3637  		parent.(*Select).Limit = newNode.(*Limit)
  3638  	}) {
  3639  		return false
  3640  	}
  3641  	if !a.rewriteRefOfSelectInto(node, node.Into, func(newNode, parent SQLNode) {
  3642  		parent.(*Select).Into = newNode.(*SelectInto)
  3643  	}) {
  3644  		return false
  3645  	}
  3646  	if a.post != nil {
  3647  		a.cur.replacer = replacer
  3648  		a.cur.parent = parent
  3649  		a.cur.node = node
  3650  		if !a.post(&a.cur) {
  3651  			return false
  3652  		}
  3653  	}
  3654  	return true
  3655  }
  3656  func (a *application) rewriteSelectExprs(parent SQLNode, node SelectExprs, replacer replacerFunc) bool {
  3657  	if node == nil {
  3658  		return true
  3659  	}
  3660  	if a.pre != nil {
  3661  		a.cur.replacer = replacer
  3662  		a.cur.parent = parent
  3663  		a.cur.node = node
  3664  		kontinue := !a.pre(&a.cur)
  3665  		if a.cur.revisit {
  3666  			node = a.cur.node.(SelectExprs)
  3667  			a.cur.revisit = false
  3668  			return a.rewriteSelectExprs(parent, node, replacer)
  3669  		}
  3670  		if kontinue {
  3671  			return true
  3672  		}
  3673  	}
  3674  	for x, el := range node {
  3675  		if !a.rewriteSelectExpr(node, el, func(idx int) replacerFunc {
  3676  			return func(newNode, parent SQLNode) {
  3677  				parent.(SelectExprs)[idx] = newNode.(SelectExpr)
  3678  			}
  3679  		}(x)) {
  3680  			return false
  3681  		}
  3682  	}
  3683  	if a.post != nil {
  3684  		a.cur.replacer = replacer
  3685  		a.cur.parent = parent
  3686  		a.cur.node = node
  3687  		if !a.post(&a.cur) {
  3688  			return false
  3689  		}
  3690  	}
  3691  	return true
  3692  }
  3693  func (a *application) rewriteRefOfSelectInto(parent SQLNode, node *SelectInto, replacer replacerFunc) bool {
  3694  	if node == nil {
  3695  		return true
  3696  	}
  3697  	if a.pre != nil {
  3698  		a.cur.replacer = replacer
  3699  		a.cur.parent = parent
  3700  		a.cur.node = node
  3701  		if !a.pre(&a.cur) {
  3702  			return true
  3703  		}
  3704  	}
  3705  	if a.post != nil {
  3706  		if a.pre == nil {
  3707  			a.cur.replacer = replacer
  3708  			a.cur.parent = parent
  3709  			a.cur.node = node
  3710  		}
  3711  		if !a.post(&a.cur) {
  3712  			return false
  3713  		}
  3714  	}
  3715  	return true
  3716  }
  3717  func (a *application) rewriteRefOfSet(parent SQLNode, node *Set, replacer replacerFunc) bool {
  3718  	if node == nil {
  3719  		return true
  3720  	}
  3721  	if a.pre != nil {
  3722  		a.cur.replacer = replacer
  3723  		a.cur.parent = parent
  3724  		a.cur.node = node
  3725  		if !a.pre(&a.cur) {
  3726  			return true
  3727  		}
  3728  	}
  3729  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  3730  		parent.(*Set).Comments = newNode.(Comments)
  3731  	}) {
  3732  		return false
  3733  	}
  3734  	if !a.rewriteSetExprs(node, node.Exprs, func(newNode, parent SQLNode) {
  3735  		parent.(*Set).Exprs = newNode.(SetExprs)
  3736  	}) {
  3737  		return false
  3738  	}
  3739  	if a.post != nil {
  3740  		a.cur.replacer = replacer
  3741  		a.cur.parent = parent
  3742  		a.cur.node = node
  3743  		if !a.post(&a.cur) {
  3744  			return false
  3745  		}
  3746  	}
  3747  	return true
  3748  }
  3749  func (a *application) rewriteRefOfSetExpr(parent SQLNode, node *SetExpr, replacer replacerFunc) bool {
  3750  	if node == nil {
  3751  		return true
  3752  	}
  3753  	if a.pre != nil {
  3754  		a.cur.replacer = replacer
  3755  		a.cur.parent = parent
  3756  		a.cur.node = node
  3757  		if !a.pre(&a.cur) {
  3758  			return true
  3759  		}
  3760  	}
  3761  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  3762  		parent.(*SetExpr).Name = newNode.(ColIdent)
  3763  	}) {
  3764  		return false
  3765  	}
  3766  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  3767  		parent.(*SetExpr).Expr = newNode.(Expr)
  3768  	}) {
  3769  		return false
  3770  	}
  3771  	if a.post != nil {
  3772  		a.cur.replacer = replacer
  3773  		a.cur.parent = parent
  3774  		a.cur.node = node
  3775  		if !a.post(&a.cur) {
  3776  			return false
  3777  		}
  3778  	}
  3779  	return true
  3780  }
  3781  func (a *application) rewriteSetExprs(parent SQLNode, node SetExprs, replacer replacerFunc) bool {
  3782  	if node == nil {
  3783  		return true
  3784  	}
  3785  	if a.pre != nil {
  3786  		a.cur.replacer = replacer
  3787  		a.cur.parent = parent
  3788  		a.cur.node = node
  3789  		kontinue := !a.pre(&a.cur)
  3790  		if a.cur.revisit {
  3791  			node = a.cur.node.(SetExprs)
  3792  			a.cur.revisit = false
  3793  			return a.rewriteSetExprs(parent, node, replacer)
  3794  		}
  3795  		if kontinue {
  3796  			return true
  3797  		}
  3798  	}
  3799  	for x, el := range node {
  3800  		if !a.rewriteRefOfSetExpr(node, el, func(idx int) replacerFunc {
  3801  			return func(newNode, parent SQLNode) {
  3802  				parent.(SetExprs)[idx] = newNode.(*SetExpr)
  3803  			}
  3804  		}(x)) {
  3805  			return false
  3806  		}
  3807  	}
  3808  	if a.post != nil {
  3809  		a.cur.replacer = replacer
  3810  		a.cur.parent = parent
  3811  		a.cur.node = node
  3812  		if !a.post(&a.cur) {
  3813  			return false
  3814  		}
  3815  	}
  3816  	return true
  3817  }
  3818  func (a *application) rewriteRefOfSetTransaction(parent SQLNode, node *SetTransaction, replacer replacerFunc) bool {
  3819  	if node == nil {
  3820  		return true
  3821  	}
  3822  	if a.pre != nil {
  3823  		a.cur.replacer = replacer
  3824  		a.cur.parent = parent
  3825  		a.cur.node = node
  3826  		if !a.pre(&a.cur) {
  3827  			return true
  3828  		}
  3829  	}
  3830  	if !a.rewriteSQLNode(node, node.SQLNode, func(newNode, parent SQLNode) {
  3831  		parent.(*SetTransaction).SQLNode = newNode.(SQLNode)
  3832  	}) {
  3833  		return false
  3834  	}
  3835  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  3836  		parent.(*SetTransaction).Comments = newNode.(Comments)
  3837  	}) {
  3838  		return false
  3839  	}
  3840  	for x, el := range node.Characteristics {
  3841  		if !a.rewriteCharacteristic(node, el, func(idx int) replacerFunc {
  3842  			return func(newNode, parent SQLNode) {
  3843  				parent.(*SetTransaction).Characteristics[idx] = newNode.(Characteristic)
  3844  			}
  3845  		}(x)) {
  3846  			return false
  3847  		}
  3848  	}
  3849  	if a.post != nil {
  3850  		a.cur.replacer = replacer
  3851  		a.cur.parent = parent
  3852  		a.cur.node = node
  3853  		if !a.post(&a.cur) {
  3854  			return false
  3855  		}
  3856  	}
  3857  	return true
  3858  }
  3859  func (a *application) rewriteRefOfShow(parent SQLNode, node *Show, replacer replacerFunc) bool {
  3860  	if node == nil {
  3861  		return true
  3862  	}
  3863  	if a.pre != nil {
  3864  		a.cur.replacer = replacer
  3865  		a.cur.parent = parent
  3866  		a.cur.node = node
  3867  		if !a.pre(&a.cur) {
  3868  			return true
  3869  		}
  3870  	}
  3871  	if !a.rewriteShowInternal(node, node.Internal, func(newNode, parent SQLNode) {
  3872  		parent.(*Show).Internal = newNode.(ShowInternal)
  3873  	}) {
  3874  		return false
  3875  	}
  3876  	if a.post != nil {
  3877  		a.cur.replacer = replacer
  3878  		a.cur.parent = parent
  3879  		a.cur.node = node
  3880  		if !a.post(&a.cur) {
  3881  			return false
  3882  		}
  3883  	}
  3884  	return true
  3885  }
  3886  func (a *application) rewriteRefOfShowBasic(parent SQLNode, node *ShowBasic, replacer replacerFunc) bool {
  3887  	if node == nil {
  3888  		return true
  3889  	}
  3890  	if a.pre != nil {
  3891  		a.cur.replacer = replacer
  3892  		a.cur.parent = parent
  3893  		a.cur.node = node
  3894  		if !a.pre(&a.cur) {
  3895  			return true
  3896  		}
  3897  	}
  3898  	if !a.rewriteTableName(node, node.Tbl, func(newNode, parent SQLNode) {
  3899  		parent.(*ShowBasic).Tbl = newNode.(TableName)
  3900  	}) {
  3901  		return false
  3902  	}
  3903  	if !a.rewriteTableIdent(node, node.DbName, func(newNode, parent SQLNode) {
  3904  		parent.(*ShowBasic).DbName = newNode.(TableIdent)
  3905  	}) {
  3906  		return false
  3907  	}
  3908  	if !a.rewriteRefOfShowFilter(node, node.Filter, func(newNode, parent SQLNode) {
  3909  		parent.(*ShowBasic).Filter = newNode.(*ShowFilter)
  3910  	}) {
  3911  		return false
  3912  	}
  3913  	if a.post != nil {
  3914  		a.cur.replacer = replacer
  3915  		a.cur.parent = parent
  3916  		a.cur.node = node
  3917  		if !a.post(&a.cur) {
  3918  			return false
  3919  		}
  3920  	}
  3921  	return true
  3922  }
  3923  func (a *application) rewriteRefOfShowCreate(parent SQLNode, node *ShowCreate, replacer replacerFunc) bool {
  3924  	if node == nil {
  3925  		return true
  3926  	}
  3927  	if a.pre != nil {
  3928  		a.cur.replacer = replacer
  3929  		a.cur.parent = parent
  3930  		a.cur.node = node
  3931  		if !a.pre(&a.cur) {
  3932  			return true
  3933  		}
  3934  	}
  3935  	if !a.rewriteTableName(node, node.Op, func(newNode, parent SQLNode) {
  3936  		parent.(*ShowCreate).Op = newNode.(TableName)
  3937  	}) {
  3938  		return false
  3939  	}
  3940  	if a.post != nil {
  3941  		a.cur.replacer = replacer
  3942  		a.cur.parent = parent
  3943  		a.cur.node = node
  3944  		if !a.post(&a.cur) {
  3945  			return false
  3946  		}
  3947  	}
  3948  	return true
  3949  }
  3950  func (a *application) rewriteRefOfShowFilter(parent SQLNode, node *ShowFilter, replacer replacerFunc) bool {
  3951  	if node == nil {
  3952  		return true
  3953  	}
  3954  	if a.pre != nil {
  3955  		a.cur.replacer = replacer
  3956  		a.cur.parent = parent
  3957  		a.cur.node = node
  3958  		if !a.pre(&a.cur) {
  3959  			return true
  3960  		}
  3961  	}
  3962  	if !a.rewriteExpr(node, node.Filter, func(newNode, parent SQLNode) {
  3963  		parent.(*ShowFilter).Filter = newNode.(Expr)
  3964  	}) {
  3965  		return false
  3966  	}
  3967  	if a.post != nil {
  3968  		a.cur.replacer = replacer
  3969  		a.cur.parent = parent
  3970  		a.cur.node = node
  3971  		if !a.post(&a.cur) {
  3972  			return false
  3973  		}
  3974  	}
  3975  	return true
  3976  }
  3977  func (a *application) rewriteRefOfShowLegacy(parent SQLNode, node *ShowLegacy, replacer replacerFunc) bool {
  3978  	if node == nil {
  3979  		return true
  3980  	}
  3981  	if a.pre != nil {
  3982  		a.cur.replacer = replacer
  3983  		a.cur.parent = parent
  3984  		a.cur.node = node
  3985  		if !a.pre(&a.cur) {
  3986  			return true
  3987  		}
  3988  	}
  3989  	if !a.rewriteTableName(node, node.OnTable, func(newNode, parent SQLNode) {
  3990  		parent.(*ShowLegacy).OnTable = newNode.(TableName)
  3991  	}) {
  3992  		return false
  3993  	}
  3994  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  3995  		parent.(*ShowLegacy).Table = newNode.(TableName)
  3996  	}) {
  3997  		return false
  3998  	}
  3999  	if !a.rewriteExpr(node, node.ShowCollationFilterOpt, func(newNode, parent SQLNode) {
  4000  		parent.(*ShowLegacy).ShowCollationFilterOpt = newNode.(Expr)
  4001  	}) {
  4002  		return false
  4003  	}
  4004  	if a.post != nil {
  4005  		a.cur.replacer = replacer
  4006  		a.cur.parent = parent
  4007  		a.cur.node = node
  4008  		if !a.post(&a.cur) {
  4009  			return false
  4010  		}
  4011  	}
  4012  	return true
  4013  }
  4014  func (a *application) rewriteRefOfShowMigrationLogs(parent SQLNode, node *ShowMigrationLogs, replacer replacerFunc) bool {
  4015  	if node == nil {
  4016  		return true
  4017  	}
  4018  	if a.pre != nil {
  4019  		a.cur.replacer = replacer
  4020  		a.cur.parent = parent
  4021  		a.cur.node = node
  4022  		if !a.pre(&a.cur) {
  4023  			return true
  4024  		}
  4025  	}
  4026  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  4027  		parent.(*ShowMigrationLogs).Comments = newNode.(Comments)
  4028  	}) {
  4029  		return false
  4030  	}
  4031  	if a.post != nil {
  4032  		a.cur.replacer = replacer
  4033  		a.cur.parent = parent
  4034  		a.cur.node = node
  4035  		if !a.post(&a.cur) {
  4036  			return false
  4037  		}
  4038  	}
  4039  	return true
  4040  }
  4041  func (a *application) rewriteRefOfStarExpr(parent SQLNode, node *StarExpr, replacer replacerFunc) bool {
  4042  	if node == nil {
  4043  		return true
  4044  	}
  4045  	if a.pre != nil {
  4046  		a.cur.replacer = replacer
  4047  		a.cur.parent = parent
  4048  		a.cur.node = node
  4049  		if !a.pre(&a.cur) {
  4050  			return true
  4051  		}
  4052  	}
  4053  	if !a.rewriteTableName(node, node.TableName, func(newNode, parent SQLNode) {
  4054  		parent.(*StarExpr).TableName = newNode.(TableName)
  4055  	}) {
  4056  		return false
  4057  	}
  4058  	if a.post != nil {
  4059  		a.cur.replacer = replacer
  4060  		a.cur.parent = parent
  4061  		a.cur.node = node
  4062  		if !a.post(&a.cur) {
  4063  			return false
  4064  		}
  4065  	}
  4066  	return true
  4067  }
  4068  func (a *application) rewriteRefOfStream(parent SQLNode, node *Stream, replacer replacerFunc) bool {
  4069  	if node == nil {
  4070  		return true
  4071  	}
  4072  	if a.pre != nil {
  4073  		a.cur.replacer = replacer
  4074  		a.cur.parent = parent
  4075  		a.cur.node = node
  4076  		if !a.pre(&a.cur) {
  4077  			return true
  4078  		}
  4079  	}
  4080  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  4081  		parent.(*Stream).Comments = newNode.(Comments)
  4082  	}) {
  4083  		return false
  4084  	}
  4085  	if !a.rewriteSelectExpr(node, node.SelectExpr, func(newNode, parent SQLNode) {
  4086  		parent.(*Stream).SelectExpr = newNode.(SelectExpr)
  4087  	}) {
  4088  		return false
  4089  	}
  4090  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  4091  		parent.(*Stream).Table = newNode.(TableName)
  4092  	}) {
  4093  		return false
  4094  	}
  4095  	if a.post != nil {
  4096  		a.cur.replacer = replacer
  4097  		a.cur.parent = parent
  4098  		a.cur.node = node
  4099  		if !a.post(&a.cur) {
  4100  			return false
  4101  		}
  4102  	}
  4103  	return true
  4104  }
  4105  func (a *application) rewriteRefOfSubPartition(parent SQLNode, node *SubPartition, replacer replacerFunc) bool {
  4106  	if node == nil {
  4107  		return true
  4108  	}
  4109  	if a.pre != nil {
  4110  		a.cur.replacer = replacer
  4111  		a.cur.parent = parent
  4112  		a.cur.node = node
  4113  		if !a.pre(&a.cur) {
  4114  			return true
  4115  		}
  4116  	}
  4117  	if !a.rewriteColumns(node, node.KeyColList, func(newNode, parent SQLNode) {
  4118  		parent.(*SubPartition).KeyColList = newNode.(Columns)
  4119  	}) {
  4120  		return false
  4121  	}
  4122  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  4123  		parent.(*SubPartition).Expr = newNode.(Expr)
  4124  	}) {
  4125  		return false
  4126  	}
  4127  	if a.post != nil {
  4128  		a.cur.replacer = replacer
  4129  		a.cur.parent = parent
  4130  		a.cur.node = node
  4131  		if !a.post(&a.cur) {
  4132  			return false
  4133  		}
  4134  	}
  4135  	return true
  4136  }
  4137  func (a *application) rewriteRefOfSubquery(parent SQLNode, node *Subquery, replacer replacerFunc) bool {
  4138  	if node == nil {
  4139  		return true
  4140  	}
  4141  	if a.pre != nil {
  4142  		a.cur.replacer = replacer
  4143  		a.cur.parent = parent
  4144  		a.cur.node = node
  4145  		if !a.pre(&a.cur) {
  4146  			return true
  4147  		}
  4148  	}
  4149  	if !a.rewriteSelectStatement(node, node.Select, func(newNode, parent SQLNode) {
  4150  		parent.(*Subquery).Select = newNode.(SelectStatement)
  4151  	}) {
  4152  		return false
  4153  	}
  4154  	if a.post != nil {
  4155  		a.cur.replacer = replacer
  4156  		a.cur.parent = parent
  4157  		a.cur.node = node
  4158  		if !a.post(&a.cur) {
  4159  			return false
  4160  		}
  4161  	}
  4162  	return true
  4163  }
  4164  func (a *application) rewriteRefOfSubstrExpr(parent SQLNode, node *SubstrExpr, replacer replacerFunc) bool {
  4165  	if node == nil {
  4166  		return true
  4167  	}
  4168  	if a.pre != nil {
  4169  		a.cur.replacer = replacer
  4170  		a.cur.parent = parent
  4171  		a.cur.node = node
  4172  		if !a.pre(&a.cur) {
  4173  			return true
  4174  		}
  4175  	}
  4176  	if !a.rewriteExpr(node, node.Name, func(newNode, parent SQLNode) {
  4177  		parent.(*SubstrExpr).Name = newNode.(Expr)
  4178  	}) {
  4179  		return false
  4180  	}
  4181  	if !a.rewriteExpr(node, node.From, func(newNode, parent SQLNode) {
  4182  		parent.(*SubstrExpr).From = newNode.(Expr)
  4183  	}) {
  4184  		return false
  4185  	}
  4186  	if !a.rewriteExpr(node, node.To, func(newNode, parent SQLNode) {
  4187  		parent.(*SubstrExpr).To = newNode.(Expr)
  4188  	}) {
  4189  		return false
  4190  	}
  4191  	if a.post != nil {
  4192  		a.cur.replacer = replacer
  4193  		a.cur.parent = parent
  4194  		a.cur.node = node
  4195  		if !a.post(&a.cur) {
  4196  			return false
  4197  		}
  4198  	}
  4199  	return true
  4200  }
  4201  func (a *application) rewriteTableExprs(parent SQLNode, node TableExprs, replacer replacerFunc) bool {
  4202  	if node == nil {
  4203  		return true
  4204  	}
  4205  	if a.pre != nil {
  4206  		a.cur.replacer = replacer
  4207  		a.cur.parent = parent
  4208  		a.cur.node = node
  4209  		kontinue := !a.pre(&a.cur)
  4210  		if a.cur.revisit {
  4211  			node = a.cur.node.(TableExprs)
  4212  			a.cur.revisit = false
  4213  			return a.rewriteTableExprs(parent, node, replacer)
  4214  		}
  4215  		if kontinue {
  4216  			return true
  4217  		}
  4218  	}
  4219  	for x, el := range node {
  4220  		if !a.rewriteTableExpr(node, el, func(idx int) replacerFunc {
  4221  			return func(newNode, parent SQLNode) {
  4222  				parent.(TableExprs)[idx] = newNode.(TableExpr)
  4223  			}
  4224  		}(x)) {
  4225  			return false
  4226  		}
  4227  	}
  4228  	if a.post != nil {
  4229  		a.cur.replacer = replacer
  4230  		a.cur.parent = parent
  4231  		a.cur.node = node
  4232  		if !a.post(&a.cur) {
  4233  			return false
  4234  		}
  4235  	}
  4236  	return true
  4237  }
  4238  func (a *application) rewriteTableIdent(parent SQLNode, node TableIdent, replacer replacerFunc) bool {
  4239  	if a.pre != nil {
  4240  		a.cur.replacer = replacer
  4241  		a.cur.parent = parent
  4242  		a.cur.node = node
  4243  		if !a.pre(&a.cur) {
  4244  			return true
  4245  		}
  4246  	}
  4247  	if a.post != nil {
  4248  		if a.pre == nil {
  4249  			a.cur.replacer = replacer
  4250  			a.cur.parent = parent
  4251  			a.cur.node = node
  4252  		}
  4253  		if !a.post(&a.cur) {
  4254  			return false
  4255  		}
  4256  	}
  4257  	return true
  4258  }
  4259  func (a *application) rewriteTableName(parent SQLNode, node TableName, replacer replacerFunc) bool {
  4260  	if a.pre != nil {
  4261  		a.cur.replacer = replacer
  4262  		a.cur.parent = parent
  4263  		a.cur.node = node
  4264  		if !a.pre(&a.cur) {
  4265  			return true
  4266  		}
  4267  	}
  4268  	if !a.rewriteTableIdent(node, node.Name, func(newNode, parent SQLNode) {
  4269  		panic("[BUG] tried to replace 'Name' on 'TableName'")
  4270  	}) {
  4271  		return false
  4272  	}
  4273  	if !a.rewriteTableIdent(node, node.Qualifier, func(newNode, parent SQLNode) {
  4274  		panic("[BUG] tried to replace 'Qualifier' on 'TableName'")
  4275  	}) {
  4276  		return false
  4277  	}
  4278  	if a.post != nil {
  4279  		a.cur.replacer = replacer
  4280  		a.cur.parent = parent
  4281  		a.cur.node = node
  4282  		if !a.post(&a.cur) {
  4283  			return false
  4284  		}
  4285  	}
  4286  	return true
  4287  }
  4288  func (a *application) rewriteTableNames(parent SQLNode, node TableNames, replacer replacerFunc) bool {
  4289  	if node == nil {
  4290  		return true
  4291  	}
  4292  	if a.pre != nil {
  4293  		a.cur.replacer = replacer
  4294  		a.cur.parent = parent
  4295  		a.cur.node = node
  4296  		kontinue := !a.pre(&a.cur)
  4297  		if a.cur.revisit {
  4298  			node = a.cur.node.(TableNames)
  4299  			a.cur.revisit = false
  4300  			return a.rewriteTableNames(parent, node, replacer)
  4301  		}
  4302  		if kontinue {
  4303  			return true
  4304  		}
  4305  	}
  4306  	for x, el := range node {
  4307  		if !a.rewriteTableName(node, el, func(idx int) replacerFunc {
  4308  			return func(newNode, parent SQLNode) {
  4309  				parent.(TableNames)[idx] = newNode.(TableName)
  4310  			}
  4311  		}(x)) {
  4312  			return false
  4313  		}
  4314  	}
  4315  	if a.post != nil {
  4316  		a.cur.replacer = replacer
  4317  		a.cur.parent = parent
  4318  		a.cur.node = node
  4319  		if !a.post(&a.cur) {
  4320  			return false
  4321  		}
  4322  	}
  4323  	return true
  4324  }
  4325  func (a *application) rewriteTableOptions(parent SQLNode, node TableOptions, replacer replacerFunc) bool {
  4326  	if node == nil {
  4327  		return true
  4328  	}
  4329  	if a.pre != nil {
  4330  		a.cur.replacer = replacer
  4331  		a.cur.parent = parent
  4332  		a.cur.node = node
  4333  		kontinue := !a.pre(&a.cur)
  4334  		if a.cur.revisit {
  4335  			node = a.cur.node.(TableOptions)
  4336  			a.cur.revisit = false
  4337  			return a.rewriteTableOptions(parent, node, replacer)
  4338  		}
  4339  		if kontinue {
  4340  			return true
  4341  		}
  4342  	}
  4343  	if a.post != nil {
  4344  		if a.pre == nil {
  4345  			a.cur.replacer = replacer
  4346  			a.cur.parent = parent
  4347  			a.cur.node = node
  4348  		}
  4349  		if !a.post(&a.cur) {
  4350  			return false
  4351  		}
  4352  	}
  4353  	return true
  4354  }
  4355  func (a *application) rewriteRefOfTableSpec(parent SQLNode, node *TableSpec, replacer replacerFunc) bool {
  4356  	if node == nil {
  4357  		return true
  4358  	}
  4359  	if a.pre != nil {
  4360  		a.cur.replacer = replacer
  4361  		a.cur.parent = parent
  4362  		a.cur.node = node
  4363  		if !a.pre(&a.cur) {
  4364  			return true
  4365  		}
  4366  	}
  4367  	for x, el := range node.Columns {
  4368  		if !a.rewriteRefOfColumnDefinition(node, el, func(idx int) replacerFunc {
  4369  			return func(newNode, parent SQLNode) {
  4370  				parent.(*TableSpec).Columns[idx] = newNode.(*ColumnDefinition)
  4371  			}
  4372  		}(x)) {
  4373  			return false
  4374  		}
  4375  	}
  4376  	for x, el := range node.Indexes {
  4377  		if !a.rewriteRefOfIndexDefinition(node, el, func(idx int) replacerFunc {
  4378  			return func(newNode, parent SQLNode) {
  4379  				parent.(*TableSpec).Indexes[idx] = newNode.(*IndexDefinition)
  4380  			}
  4381  		}(x)) {
  4382  			return false
  4383  		}
  4384  	}
  4385  	for x, el := range node.Constraints {
  4386  		if !a.rewriteRefOfConstraintDefinition(node, el, func(idx int) replacerFunc {
  4387  			return func(newNode, parent SQLNode) {
  4388  				parent.(*TableSpec).Constraints[idx] = newNode.(*ConstraintDefinition)
  4389  			}
  4390  		}(x)) {
  4391  			return false
  4392  		}
  4393  	}
  4394  	if !a.rewriteTableOptions(node, node.Options, func(newNode, parent SQLNode) {
  4395  		parent.(*TableSpec).Options = newNode.(TableOptions)
  4396  	}) {
  4397  		return false
  4398  	}
  4399  	if !a.rewriteRefOfPartitionOption(node, node.PartitionOption, func(newNode, parent SQLNode) {
  4400  		parent.(*TableSpec).PartitionOption = newNode.(*PartitionOption)
  4401  	}) {
  4402  		return false
  4403  	}
  4404  	if a.post != nil {
  4405  		a.cur.replacer = replacer
  4406  		a.cur.parent = parent
  4407  		a.cur.node = node
  4408  		if !a.post(&a.cur) {
  4409  			return false
  4410  		}
  4411  	}
  4412  	return true
  4413  }
  4414  func (a *application) rewriteRefOfTablespaceOperation(parent SQLNode, node *TablespaceOperation, replacer replacerFunc) bool {
  4415  	if node == nil {
  4416  		return true
  4417  	}
  4418  	if a.pre != nil {
  4419  		a.cur.replacer = replacer
  4420  		a.cur.parent = parent
  4421  		a.cur.node = node
  4422  		if !a.pre(&a.cur) {
  4423  			return true
  4424  		}
  4425  	}
  4426  	if a.post != nil {
  4427  		if a.pre == nil {
  4428  			a.cur.replacer = replacer
  4429  			a.cur.parent = parent
  4430  			a.cur.node = node
  4431  		}
  4432  		if !a.post(&a.cur) {
  4433  			return false
  4434  		}
  4435  	}
  4436  	return true
  4437  }
  4438  func (a *application) rewriteRefOfTimestampFuncExpr(parent SQLNode, node *TimestampFuncExpr, replacer replacerFunc) bool {
  4439  	if node == nil {
  4440  		return true
  4441  	}
  4442  	if a.pre != nil {
  4443  		a.cur.replacer = replacer
  4444  		a.cur.parent = parent
  4445  		a.cur.node = node
  4446  		if !a.pre(&a.cur) {
  4447  			return true
  4448  		}
  4449  	}
  4450  	if !a.rewriteExpr(node, node.Expr1, func(newNode, parent SQLNode) {
  4451  		parent.(*TimestampFuncExpr).Expr1 = newNode.(Expr)
  4452  	}) {
  4453  		return false
  4454  	}
  4455  	if !a.rewriteExpr(node, node.Expr2, func(newNode, parent SQLNode) {
  4456  		parent.(*TimestampFuncExpr).Expr2 = newNode.(Expr)
  4457  	}) {
  4458  		return false
  4459  	}
  4460  	if a.post != nil {
  4461  		a.cur.replacer = replacer
  4462  		a.cur.parent = parent
  4463  		a.cur.node = node
  4464  		if !a.post(&a.cur) {
  4465  			return false
  4466  		}
  4467  	}
  4468  	return true
  4469  }
  4470  func (a *application) rewriteRefOfTruncateTable(parent SQLNode, node *TruncateTable, replacer replacerFunc) bool {
  4471  	if node == nil {
  4472  		return true
  4473  	}
  4474  	if a.pre != nil {
  4475  		a.cur.replacer = replacer
  4476  		a.cur.parent = parent
  4477  		a.cur.node = node
  4478  		if !a.pre(&a.cur) {
  4479  			return true
  4480  		}
  4481  	}
  4482  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  4483  		parent.(*TruncateTable).Table = newNode.(TableName)
  4484  	}) {
  4485  		return false
  4486  	}
  4487  	if a.post != nil {
  4488  		a.cur.replacer = replacer
  4489  		a.cur.parent = parent
  4490  		a.cur.node = node
  4491  		if !a.post(&a.cur) {
  4492  			return false
  4493  		}
  4494  	}
  4495  	return true
  4496  }
  4497  func (a *application) rewriteRefOfUnaryExpr(parent SQLNode, node *UnaryExpr, replacer replacerFunc) bool {
  4498  	if node == nil {
  4499  		return true
  4500  	}
  4501  	if a.pre != nil {
  4502  		a.cur.replacer = replacer
  4503  		a.cur.parent = parent
  4504  		a.cur.node = node
  4505  		if !a.pre(&a.cur) {
  4506  			return true
  4507  		}
  4508  	}
  4509  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  4510  		parent.(*UnaryExpr).Expr = newNode.(Expr)
  4511  	}) {
  4512  		return false
  4513  	}
  4514  	if a.post != nil {
  4515  		a.cur.replacer = replacer
  4516  		a.cur.parent = parent
  4517  		a.cur.node = node
  4518  		if !a.post(&a.cur) {
  4519  			return false
  4520  		}
  4521  	}
  4522  	return true
  4523  }
  4524  func (a *application) rewriteRefOfUnion(parent SQLNode, node *Union, replacer replacerFunc) bool {
  4525  	if node == nil {
  4526  		return true
  4527  	}
  4528  	if a.pre != nil {
  4529  		a.cur.replacer = replacer
  4530  		a.cur.parent = parent
  4531  		a.cur.node = node
  4532  		if !a.pre(&a.cur) {
  4533  			return true
  4534  		}
  4535  	}
  4536  	if !a.rewriteSelectStatement(node, node.Left, func(newNode, parent SQLNode) {
  4537  		parent.(*Union).Left = newNode.(SelectStatement)
  4538  	}) {
  4539  		return false
  4540  	}
  4541  	if !a.rewriteSelectStatement(node, node.Right, func(newNode, parent SQLNode) {
  4542  		parent.(*Union).Right = newNode.(SelectStatement)
  4543  	}) {
  4544  		return false
  4545  	}
  4546  	if !a.rewriteOrderBy(node, node.OrderBy, func(newNode, parent SQLNode) {
  4547  		parent.(*Union).OrderBy = newNode.(OrderBy)
  4548  	}) {
  4549  		return false
  4550  	}
  4551  	if !a.rewriteRefOfWith(node, node.With, func(newNode, parent SQLNode) {
  4552  		parent.(*Union).With = newNode.(*With)
  4553  	}) {
  4554  		return false
  4555  	}
  4556  	if !a.rewriteRefOfLimit(node, node.Limit, func(newNode, parent SQLNode) {
  4557  		parent.(*Union).Limit = newNode.(*Limit)
  4558  	}) {
  4559  		return false
  4560  	}
  4561  	if !a.rewriteRefOfSelectInto(node, node.Into, func(newNode, parent SQLNode) {
  4562  		parent.(*Union).Into = newNode.(*SelectInto)
  4563  	}) {
  4564  		return false
  4565  	}
  4566  	if a.post != nil {
  4567  		a.cur.replacer = replacer
  4568  		a.cur.parent = parent
  4569  		a.cur.node = node
  4570  		if !a.post(&a.cur) {
  4571  			return false
  4572  		}
  4573  	}
  4574  	return true
  4575  }
  4576  func (a *application) rewriteRefOfUnlockTables(parent SQLNode, node *UnlockTables, replacer replacerFunc) bool {
  4577  	if node == nil {
  4578  		return true
  4579  	}
  4580  	if a.pre != nil {
  4581  		a.cur.replacer = replacer
  4582  		a.cur.parent = parent
  4583  		a.cur.node = node
  4584  		if !a.pre(&a.cur) {
  4585  			return true
  4586  		}
  4587  	}
  4588  	if a.post != nil {
  4589  		if a.pre == nil {
  4590  			a.cur.replacer = replacer
  4591  			a.cur.parent = parent
  4592  			a.cur.node = node
  4593  		}
  4594  		if !a.post(&a.cur) {
  4595  			return false
  4596  		}
  4597  	}
  4598  	return true
  4599  }
  4600  func (a *application) rewriteRefOfUpdate(parent SQLNode, node *Update, replacer replacerFunc) bool {
  4601  	if node == nil {
  4602  		return true
  4603  	}
  4604  	if a.pre != nil {
  4605  		a.cur.replacer = replacer
  4606  		a.cur.parent = parent
  4607  		a.cur.node = node
  4608  		if !a.pre(&a.cur) {
  4609  			return true
  4610  		}
  4611  	}
  4612  	if !a.rewriteRefOfWith(node, node.With, func(newNode, parent SQLNode) {
  4613  		parent.(*Update).With = newNode.(*With)
  4614  	}) {
  4615  		return false
  4616  	}
  4617  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  4618  		parent.(*Update).Comments = newNode.(Comments)
  4619  	}) {
  4620  		return false
  4621  	}
  4622  	if !a.rewriteTableExprs(node, node.TableExprs, func(newNode, parent SQLNode) {
  4623  		parent.(*Update).TableExprs = newNode.(TableExprs)
  4624  	}) {
  4625  		return false
  4626  	}
  4627  	if !a.rewriteUpdateExprs(node, node.Exprs, func(newNode, parent SQLNode) {
  4628  		parent.(*Update).Exprs = newNode.(UpdateExprs)
  4629  	}) {
  4630  		return false
  4631  	}
  4632  	if !a.rewriteRefOfWhere(node, node.Where, func(newNode, parent SQLNode) {
  4633  		parent.(*Update).Where = newNode.(*Where)
  4634  	}) {
  4635  		return false
  4636  	}
  4637  	if !a.rewriteOrderBy(node, node.OrderBy, func(newNode, parent SQLNode) {
  4638  		parent.(*Update).OrderBy = newNode.(OrderBy)
  4639  	}) {
  4640  		return false
  4641  	}
  4642  	if !a.rewriteRefOfLimit(node, node.Limit, func(newNode, parent SQLNode) {
  4643  		parent.(*Update).Limit = newNode.(*Limit)
  4644  	}) {
  4645  		return false
  4646  	}
  4647  	if a.post != nil {
  4648  		a.cur.replacer = replacer
  4649  		a.cur.parent = parent
  4650  		a.cur.node = node
  4651  		if !a.post(&a.cur) {
  4652  			return false
  4653  		}
  4654  	}
  4655  	return true
  4656  }
  4657  func (a *application) rewriteRefOfUpdateExpr(parent SQLNode, node *UpdateExpr, replacer replacerFunc) bool {
  4658  	if node == nil {
  4659  		return true
  4660  	}
  4661  	if a.pre != nil {
  4662  		a.cur.replacer = replacer
  4663  		a.cur.parent = parent
  4664  		a.cur.node = node
  4665  		if !a.pre(&a.cur) {
  4666  			return true
  4667  		}
  4668  	}
  4669  	if !a.rewriteRefOfColName(node, node.Name, func(newNode, parent SQLNode) {
  4670  		parent.(*UpdateExpr).Name = newNode.(*ColName)
  4671  	}) {
  4672  		return false
  4673  	}
  4674  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  4675  		parent.(*UpdateExpr).Expr = newNode.(Expr)
  4676  	}) {
  4677  		return false
  4678  	}
  4679  	if a.post != nil {
  4680  		a.cur.replacer = replacer
  4681  		a.cur.parent = parent
  4682  		a.cur.node = node
  4683  		if !a.post(&a.cur) {
  4684  			return false
  4685  		}
  4686  	}
  4687  	return true
  4688  }
  4689  func (a *application) rewriteUpdateExprs(parent SQLNode, node UpdateExprs, replacer replacerFunc) bool {
  4690  	if node == nil {
  4691  		return true
  4692  	}
  4693  	if a.pre != nil {
  4694  		a.cur.replacer = replacer
  4695  		a.cur.parent = parent
  4696  		a.cur.node = node
  4697  		kontinue := !a.pre(&a.cur)
  4698  		if a.cur.revisit {
  4699  			node = a.cur.node.(UpdateExprs)
  4700  			a.cur.revisit = false
  4701  			return a.rewriteUpdateExprs(parent, node, replacer)
  4702  		}
  4703  		if kontinue {
  4704  			return true
  4705  		}
  4706  	}
  4707  	for x, el := range node {
  4708  		if !a.rewriteRefOfUpdateExpr(node, el, func(idx int) replacerFunc {
  4709  			return func(newNode, parent SQLNode) {
  4710  				parent.(UpdateExprs)[idx] = newNode.(*UpdateExpr)
  4711  			}
  4712  		}(x)) {
  4713  			return false
  4714  		}
  4715  	}
  4716  	if a.post != nil {
  4717  		a.cur.replacer = replacer
  4718  		a.cur.parent = parent
  4719  		a.cur.node = node
  4720  		if !a.post(&a.cur) {
  4721  			return false
  4722  		}
  4723  	}
  4724  	return true
  4725  }
  4726  func (a *application) rewriteRefOfUse(parent SQLNode, node *Use, replacer replacerFunc) bool {
  4727  	if node == nil {
  4728  		return true
  4729  	}
  4730  	if a.pre != nil {
  4731  		a.cur.replacer = replacer
  4732  		a.cur.parent = parent
  4733  		a.cur.node = node
  4734  		if !a.pre(&a.cur) {
  4735  			return true
  4736  		}
  4737  	}
  4738  	if !a.rewriteTableIdent(node, node.DBName, func(newNode, parent SQLNode) {
  4739  		parent.(*Use).DBName = newNode.(TableIdent)
  4740  	}) {
  4741  		return false
  4742  	}
  4743  	if a.post != nil {
  4744  		a.cur.replacer = replacer
  4745  		a.cur.parent = parent
  4746  		a.cur.node = node
  4747  		if !a.post(&a.cur) {
  4748  			return false
  4749  		}
  4750  	}
  4751  	return true
  4752  }
  4753  func (a *application) rewriteRefOfVStream(parent SQLNode, node *VStream, replacer replacerFunc) bool {
  4754  	if node == nil {
  4755  		return true
  4756  	}
  4757  	if a.pre != nil {
  4758  		a.cur.replacer = replacer
  4759  		a.cur.parent = parent
  4760  		a.cur.node = node
  4761  		if !a.pre(&a.cur) {
  4762  			return true
  4763  		}
  4764  	}
  4765  	if !a.rewriteComments(node, node.Comments, func(newNode, parent SQLNode) {
  4766  		parent.(*VStream).Comments = newNode.(Comments)
  4767  	}) {
  4768  		return false
  4769  	}
  4770  	if !a.rewriteSelectExpr(node, node.SelectExpr, func(newNode, parent SQLNode) {
  4771  		parent.(*VStream).SelectExpr = newNode.(SelectExpr)
  4772  	}) {
  4773  		return false
  4774  	}
  4775  	if !a.rewriteTableName(node, node.Table, func(newNode, parent SQLNode) {
  4776  		parent.(*VStream).Table = newNode.(TableName)
  4777  	}) {
  4778  		return false
  4779  	}
  4780  	if !a.rewriteRefOfWhere(node, node.Where, func(newNode, parent SQLNode) {
  4781  		parent.(*VStream).Where = newNode.(*Where)
  4782  	}) {
  4783  		return false
  4784  	}
  4785  	if !a.rewriteRefOfLimit(node, node.Limit, func(newNode, parent SQLNode) {
  4786  		parent.(*VStream).Limit = newNode.(*Limit)
  4787  	}) {
  4788  		return false
  4789  	}
  4790  	if a.post != nil {
  4791  		a.cur.replacer = replacer
  4792  		a.cur.parent = parent
  4793  		a.cur.node = node
  4794  		if !a.post(&a.cur) {
  4795  			return false
  4796  		}
  4797  	}
  4798  	return true
  4799  }
  4800  func (a *application) rewriteValTuple(parent SQLNode, node ValTuple, replacer replacerFunc) bool {
  4801  	if node == nil {
  4802  		return true
  4803  	}
  4804  	if a.pre != nil {
  4805  		a.cur.replacer = replacer
  4806  		a.cur.parent = parent
  4807  		a.cur.node = node
  4808  		kontinue := !a.pre(&a.cur)
  4809  		if a.cur.revisit {
  4810  			node = a.cur.node.(ValTuple)
  4811  			a.cur.revisit = false
  4812  			return a.rewriteValTuple(parent, node, replacer)
  4813  		}
  4814  		if kontinue {
  4815  			return true
  4816  		}
  4817  	}
  4818  	for x, el := range node {
  4819  		if !a.rewriteExpr(node, el, func(idx int) replacerFunc {
  4820  			return func(newNode, parent SQLNode) {
  4821  				parent.(ValTuple)[idx] = newNode.(Expr)
  4822  			}
  4823  		}(x)) {
  4824  			return false
  4825  		}
  4826  	}
  4827  	if a.post != nil {
  4828  		a.cur.replacer = replacer
  4829  		a.cur.parent = parent
  4830  		a.cur.node = node
  4831  		if !a.post(&a.cur) {
  4832  			return false
  4833  		}
  4834  	}
  4835  	return true
  4836  }
  4837  func (a *application) rewriteRefOfValidation(parent SQLNode, node *Validation, replacer replacerFunc) bool {
  4838  	if node == nil {
  4839  		return true
  4840  	}
  4841  	if a.pre != nil {
  4842  		a.cur.replacer = replacer
  4843  		a.cur.parent = parent
  4844  		a.cur.node = node
  4845  		if !a.pre(&a.cur) {
  4846  			return true
  4847  		}
  4848  	}
  4849  	if a.post != nil {
  4850  		if a.pre == nil {
  4851  			a.cur.replacer = replacer
  4852  			a.cur.parent = parent
  4853  			a.cur.node = node
  4854  		}
  4855  		if !a.post(&a.cur) {
  4856  			return false
  4857  		}
  4858  	}
  4859  	return true
  4860  }
  4861  func (a *application) rewriteValues(parent SQLNode, node Values, replacer replacerFunc) bool {
  4862  	if node == nil {
  4863  		return true
  4864  	}
  4865  	if a.pre != nil {
  4866  		a.cur.replacer = replacer
  4867  		a.cur.parent = parent
  4868  		a.cur.node = node
  4869  		kontinue := !a.pre(&a.cur)
  4870  		if a.cur.revisit {
  4871  			node = a.cur.node.(Values)
  4872  			a.cur.revisit = false
  4873  			return a.rewriteValues(parent, node, replacer)
  4874  		}
  4875  		if kontinue {
  4876  			return true
  4877  		}
  4878  	}
  4879  	for x, el := range node {
  4880  		if !a.rewriteValTuple(node, el, func(idx int) replacerFunc {
  4881  			return func(newNode, parent SQLNode) {
  4882  				parent.(Values)[idx] = newNode.(ValTuple)
  4883  			}
  4884  		}(x)) {
  4885  			return false
  4886  		}
  4887  	}
  4888  	if a.post != nil {
  4889  		a.cur.replacer = replacer
  4890  		a.cur.parent = parent
  4891  		a.cur.node = node
  4892  		if !a.post(&a.cur) {
  4893  			return false
  4894  		}
  4895  	}
  4896  	return true
  4897  }
  4898  func (a *application) rewriteRefOfValuesFuncExpr(parent SQLNode, node *ValuesFuncExpr, replacer replacerFunc) bool {
  4899  	if node == nil {
  4900  		return true
  4901  	}
  4902  	if a.pre != nil {
  4903  		a.cur.replacer = replacer
  4904  		a.cur.parent = parent
  4905  		a.cur.node = node
  4906  		if !a.pre(&a.cur) {
  4907  			return true
  4908  		}
  4909  	}
  4910  	if !a.rewriteRefOfColName(node, node.Name, func(newNode, parent SQLNode) {
  4911  		parent.(*ValuesFuncExpr).Name = newNode.(*ColName)
  4912  	}) {
  4913  		return false
  4914  	}
  4915  	if a.post != nil {
  4916  		a.cur.replacer = replacer
  4917  		a.cur.parent = parent
  4918  		a.cur.node = node
  4919  		if !a.post(&a.cur) {
  4920  			return false
  4921  		}
  4922  	}
  4923  	return true
  4924  }
  4925  func (a *application) rewriteVindexParam(parent SQLNode, node VindexParam, replacer replacerFunc) bool {
  4926  	if a.pre != nil {
  4927  		a.cur.replacer = replacer
  4928  		a.cur.parent = parent
  4929  		a.cur.node = node
  4930  		if !a.pre(&a.cur) {
  4931  			return true
  4932  		}
  4933  	}
  4934  	if !a.rewriteColIdent(node, node.Key, func(newNode, parent SQLNode) {
  4935  		panic("[BUG] tried to replace 'Key' on 'VindexParam'")
  4936  	}) {
  4937  		return false
  4938  	}
  4939  	if a.post != nil {
  4940  		a.cur.replacer = replacer
  4941  		a.cur.parent = parent
  4942  		a.cur.node = node
  4943  		if !a.post(&a.cur) {
  4944  			return false
  4945  		}
  4946  	}
  4947  	return true
  4948  }
  4949  func (a *application) rewriteRefOfVindexSpec(parent SQLNode, node *VindexSpec, replacer replacerFunc) bool {
  4950  	if node == nil {
  4951  		return true
  4952  	}
  4953  	if a.pre != nil {
  4954  		a.cur.replacer = replacer
  4955  		a.cur.parent = parent
  4956  		a.cur.node = node
  4957  		if !a.pre(&a.cur) {
  4958  			return true
  4959  		}
  4960  	}
  4961  	if !a.rewriteColIdent(node, node.Name, func(newNode, parent SQLNode) {
  4962  		parent.(*VindexSpec).Name = newNode.(ColIdent)
  4963  	}) {
  4964  		return false
  4965  	}
  4966  	if !a.rewriteColIdent(node, node.Type, func(newNode, parent SQLNode) {
  4967  		parent.(*VindexSpec).Type = newNode.(ColIdent)
  4968  	}) {
  4969  		return false
  4970  	}
  4971  	for x, el := range node.Params {
  4972  		if !a.rewriteVindexParam(node, el, func(idx int) replacerFunc {
  4973  			return func(newNode, parent SQLNode) {
  4974  				parent.(*VindexSpec).Params[idx] = newNode.(VindexParam)
  4975  			}
  4976  		}(x)) {
  4977  			return false
  4978  		}
  4979  	}
  4980  	if a.post != nil {
  4981  		a.cur.replacer = replacer
  4982  		a.cur.parent = parent
  4983  		a.cur.node = node
  4984  		if !a.post(&a.cur) {
  4985  			return false
  4986  		}
  4987  	}
  4988  	return true
  4989  }
  4990  func (a *application) rewriteRefOfWhen(parent SQLNode, node *When, replacer replacerFunc) bool {
  4991  	if node == nil {
  4992  		return true
  4993  	}
  4994  	if a.pre != nil {
  4995  		a.cur.replacer = replacer
  4996  		a.cur.parent = parent
  4997  		a.cur.node = node
  4998  		if !a.pre(&a.cur) {
  4999  			return true
  5000  		}
  5001  	}
  5002  	if !a.rewriteExpr(node, node.Cond, func(newNode, parent SQLNode) {
  5003  		parent.(*When).Cond = newNode.(Expr)
  5004  	}) {
  5005  		return false
  5006  	}
  5007  	if !a.rewriteExpr(node, node.Val, func(newNode, parent SQLNode) {
  5008  		parent.(*When).Val = newNode.(Expr)
  5009  	}) {
  5010  		return false
  5011  	}
  5012  	if a.post != nil {
  5013  		a.cur.replacer = replacer
  5014  		a.cur.parent = parent
  5015  		a.cur.node = node
  5016  		if !a.post(&a.cur) {
  5017  			return false
  5018  		}
  5019  	}
  5020  	return true
  5021  }
  5022  func (a *application) rewriteRefOfWhere(parent SQLNode, node *Where, replacer replacerFunc) bool {
  5023  	if node == nil {
  5024  		return true
  5025  	}
  5026  	if a.pre != nil {
  5027  		a.cur.replacer = replacer
  5028  		a.cur.parent = parent
  5029  		a.cur.node = node
  5030  		if !a.pre(&a.cur) {
  5031  			return true
  5032  		}
  5033  	}
  5034  	if !a.rewriteExpr(node, node.Expr, func(newNode, parent SQLNode) {
  5035  		parent.(*Where).Expr = newNode.(Expr)
  5036  	}) {
  5037  		return false
  5038  	}
  5039  	if a.post != nil {
  5040  		a.cur.replacer = replacer
  5041  		a.cur.parent = parent
  5042  		a.cur.node = node
  5043  		if !a.post(&a.cur) {
  5044  			return false
  5045  		}
  5046  	}
  5047  	return true
  5048  }
  5049  func (a *application) rewriteRefOfWith(parent SQLNode, node *With, replacer replacerFunc) bool {
  5050  	if node == nil {
  5051  		return true
  5052  	}
  5053  	if a.pre != nil {
  5054  		a.cur.replacer = replacer
  5055  		a.cur.parent = parent
  5056  		a.cur.node = node
  5057  		if !a.pre(&a.cur) {
  5058  			return true
  5059  		}
  5060  	}
  5061  	for x, el := range node.ctes {
  5062  		if !a.rewriteRefOfCommonTableExpr(node, el, func(idx int) replacerFunc {
  5063  			return func(newNode, parent SQLNode) {
  5064  				parent.(*With).ctes[idx] = newNode.(*CommonTableExpr)
  5065  			}
  5066  		}(x)) {
  5067  			return false
  5068  		}
  5069  	}
  5070  	if a.post != nil {
  5071  		a.cur.replacer = replacer
  5072  		a.cur.parent = parent
  5073  		a.cur.node = node
  5074  		if !a.post(&a.cur) {
  5075  			return false
  5076  		}
  5077  	}
  5078  	return true
  5079  }
  5080  func (a *application) rewriteRefOfXorExpr(parent SQLNode, node *XorExpr, replacer replacerFunc) bool {
  5081  	if node == nil {
  5082  		return true
  5083  	}
  5084  	if a.pre != nil {
  5085  		a.cur.replacer = replacer
  5086  		a.cur.parent = parent
  5087  		a.cur.node = node
  5088  		if !a.pre(&a.cur) {
  5089  			return true
  5090  		}
  5091  	}
  5092  	if !a.rewriteExpr(node, node.Left, func(newNode, parent SQLNode) {
  5093  		parent.(*XorExpr).Left = newNode.(Expr)
  5094  	}) {
  5095  		return false
  5096  	}
  5097  	if !a.rewriteExpr(node, node.Right, func(newNode, parent SQLNode) {
  5098  		parent.(*XorExpr).Right = newNode.(Expr)
  5099  	}) {
  5100  		return false
  5101  	}
  5102  	if a.post != nil {
  5103  		a.cur.replacer = replacer
  5104  		a.cur.parent = parent
  5105  		a.cur.node = node
  5106  		if !a.post(&a.cur) {
  5107  			return false
  5108  		}
  5109  	}
  5110  	return true
  5111  }
  5112  func (a *application) rewriteAlterOption(parent SQLNode, node AlterOption, replacer replacerFunc) bool {
  5113  	if node == nil {
  5114  		return true
  5115  	}
  5116  	switch node := node.(type) {
  5117  	case *AddColumns:
  5118  		return a.rewriteRefOfAddColumns(parent, node, replacer)
  5119  	case *AddConstraintDefinition:
  5120  		return a.rewriteRefOfAddConstraintDefinition(parent, node, replacer)
  5121  	case *AddIndexDefinition:
  5122  		return a.rewriteRefOfAddIndexDefinition(parent, node, replacer)
  5123  	case AlgorithmValue:
  5124  		return a.rewriteAlgorithmValue(parent, node, replacer)
  5125  	case *AlterCharset:
  5126  		return a.rewriteRefOfAlterCharset(parent, node, replacer)
  5127  	case *AlterColumn:
  5128  		return a.rewriteRefOfAlterColumn(parent, node, replacer)
  5129  	case *ChangeColumn:
  5130  		return a.rewriteRefOfChangeColumn(parent, node, replacer)
  5131  	case *DropColumn:
  5132  		return a.rewriteRefOfDropColumn(parent, node, replacer)
  5133  	case *DropKey:
  5134  		return a.rewriteRefOfDropKey(parent, node, replacer)
  5135  	case *Force:
  5136  		return a.rewriteRefOfForce(parent, node, replacer)
  5137  	case *KeyState:
  5138  		return a.rewriteRefOfKeyState(parent, node, replacer)
  5139  	case *LockOption:
  5140  		return a.rewriteRefOfLockOption(parent, node, replacer)
  5141  	case *ModifyColumn:
  5142  		return a.rewriteRefOfModifyColumn(parent, node, replacer)
  5143  	case *OrderByOption:
  5144  		return a.rewriteRefOfOrderByOption(parent, node, replacer)
  5145  	case *RenameIndex:
  5146  		return a.rewriteRefOfRenameIndex(parent, node, replacer)
  5147  	case *RenameTableName:
  5148  		return a.rewriteRefOfRenameTableName(parent, node, replacer)
  5149  	case TableOptions:
  5150  		return a.rewriteTableOptions(parent, node, replacer)
  5151  	case *TablespaceOperation:
  5152  		return a.rewriteRefOfTablespaceOperation(parent, node, replacer)
  5153  	case *Validation:
  5154  		return a.rewriteRefOfValidation(parent, node, replacer)
  5155  	default:
  5156  		// this should never happen
  5157  		return true
  5158  	}
  5159  }
  5160  func (a *application) rewriteCharacteristic(parent SQLNode, node Characteristic, replacer replacerFunc) bool {
  5161  	if node == nil {
  5162  		return true
  5163  	}
  5164  	switch node := node.(type) {
  5165  	case AccessMode:
  5166  		return a.rewriteAccessMode(parent, node, replacer)
  5167  	case IsolationLevel:
  5168  		return a.rewriteIsolationLevel(parent, node, replacer)
  5169  	default:
  5170  		// this should never happen
  5171  		return true
  5172  	}
  5173  }
  5174  func (a *application) rewriteColTuple(parent SQLNode, node ColTuple, replacer replacerFunc) bool {
  5175  	if node == nil {
  5176  		return true
  5177  	}
  5178  	switch node := node.(type) {
  5179  	case ListArg:
  5180  		return a.rewriteListArg(parent, node, replacer)
  5181  	case *Subquery:
  5182  		return a.rewriteRefOfSubquery(parent, node, replacer)
  5183  	case ValTuple:
  5184  		return a.rewriteValTuple(parent, node, replacer)
  5185  	default:
  5186  		// this should never happen
  5187  		return true
  5188  	}
  5189  }
  5190  func (a *application) rewriteConstraintInfo(parent SQLNode, node ConstraintInfo, replacer replacerFunc) bool {
  5191  	if node == nil {
  5192  		return true
  5193  	}
  5194  	switch node := node.(type) {
  5195  	case *CheckConstraintDefinition:
  5196  		return a.rewriteRefOfCheckConstraintDefinition(parent, node, replacer)
  5197  	case *ForeignKeyDefinition:
  5198  		return a.rewriteRefOfForeignKeyDefinition(parent, node, replacer)
  5199  	default:
  5200  		// this should never happen
  5201  		return true
  5202  	}
  5203  }
  5204  func (a *application) rewriteDBDDLStatement(parent SQLNode, node DBDDLStatement, replacer replacerFunc) bool {
  5205  	if node == nil {
  5206  		return true
  5207  	}
  5208  	switch node := node.(type) {
  5209  	case *AlterDatabase:
  5210  		return a.rewriteRefOfAlterDatabase(parent, node, replacer)
  5211  	case *CreateDatabase:
  5212  		return a.rewriteRefOfCreateDatabase(parent, node, replacer)
  5213  	case *DropDatabase:
  5214  		return a.rewriteRefOfDropDatabase(parent, node, replacer)
  5215  	default:
  5216  		// this should never happen
  5217  		return true
  5218  	}
  5219  }
  5220  func (a *application) rewriteDDLStatement(parent SQLNode, node DDLStatement, replacer replacerFunc) bool {
  5221  	if node == nil {
  5222  		return true
  5223  	}
  5224  	switch node := node.(type) {
  5225  	case *AlterTable:
  5226  		return a.rewriteRefOfAlterTable(parent, node, replacer)
  5227  	case *AlterView:
  5228  		return a.rewriteRefOfAlterView(parent, node, replacer)
  5229  	case *CreateTable:
  5230  		return a.rewriteRefOfCreateTable(parent, node, replacer)
  5231  	case *CreateView:
  5232  		return a.rewriteRefOfCreateView(parent, node, replacer)
  5233  	case *DropTable:
  5234  		return a.rewriteRefOfDropTable(parent, node, replacer)
  5235  	case *DropView:
  5236  		return a.rewriteRefOfDropView(parent, node, replacer)
  5237  	case *RenameTable:
  5238  		return a.rewriteRefOfRenameTable(parent, node, replacer)
  5239  	case *TruncateTable:
  5240  		return a.rewriteRefOfTruncateTable(parent, node, replacer)
  5241  	default:
  5242  		// this should never happen
  5243  		return true
  5244  	}
  5245  }
  5246  func (a *application) rewriteExplain(parent SQLNode, node Explain, replacer replacerFunc) bool {
  5247  	if node == nil {
  5248  		return true
  5249  	}
  5250  	switch node := node.(type) {
  5251  	case *ExplainStmt:
  5252  		return a.rewriteRefOfExplainStmt(parent, node, replacer)
  5253  	case *ExplainTab:
  5254  		return a.rewriteRefOfExplainTab(parent, node, replacer)
  5255  	default:
  5256  		// this should never happen
  5257  		return true
  5258  	}
  5259  }
  5260  func (a *application) rewriteExpr(parent SQLNode, node Expr, replacer replacerFunc) bool {
  5261  	if node == nil {
  5262  		return true
  5263  	}
  5264  	switch node := node.(type) {
  5265  	case *AndExpr:
  5266  		return a.rewriteRefOfAndExpr(parent, node, replacer)
  5267  	case Argument:
  5268  		return a.rewriteArgument(parent, node, replacer)
  5269  	case *BetweenExpr:
  5270  		return a.rewriteRefOfBetweenExpr(parent, node, replacer)
  5271  	case *BinaryExpr:
  5272  		return a.rewriteRefOfBinaryExpr(parent, node, replacer)
  5273  	case BoolVal:
  5274  		return a.rewriteBoolVal(parent, node, replacer)
  5275  	case *CaseExpr:
  5276  		return a.rewriteRefOfCaseExpr(parent, node, replacer)
  5277  	case *ColName:
  5278  		return a.rewriteRefOfColName(parent, node, replacer)
  5279  	case *CollateExpr:
  5280  		return a.rewriteRefOfCollateExpr(parent, node, replacer)
  5281  	case *ComparisonExpr:
  5282  		return a.rewriteRefOfComparisonExpr(parent, node, replacer)
  5283  	case *ConvertExpr:
  5284  		return a.rewriteRefOfConvertExpr(parent, node, replacer)
  5285  	case *ConvertUsingExpr:
  5286  		return a.rewriteRefOfConvertUsingExpr(parent, node, replacer)
  5287  	case *CurTimeFuncExpr:
  5288  		return a.rewriteRefOfCurTimeFuncExpr(parent, node, replacer)
  5289  	case *Default:
  5290  		return a.rewriteRefOfDefault(parent, node, replacer)
  5291  	case *ExistsExpr:
  5292  		return a.rewriteRefOfExistsExpr(parent, node, replacer)
  5293  	case *ExtractFuncExpr:
  5294  		return a.rewriteRefOfExtractFuncExpr(parent, node, replacer)
  5295  	case *ExtractedSubquery:
  5296  		return a.rewriteRefOfExtractedSubquery(parent, node, replacer)
  5297  	case *FuncExpr:
  5298  		return a.rewriteRefOfFuncExpr(parent, node, replacer)
  5299  	case *GroupConcatExpr:
  5300  		return a.rewriteRefOfGroupConcatExpr(parent, node, replacer)
  5301  	case *IntervalExpr:
  5302  		return a.rewriteRefOfIntervalExpr(parent, node, replacer)
  5303  	case *IntroducerExpr:
  5304  		return a.rewriteRefOfIntroducerExpr(parent, node, replacer)
  5305  	case *IsExpr:
  5306  		return a.rewriteRefOfIsExpr(parent, node, replacer)
  5307  	case ListArg:
  5308  		return a.rewriteListArg(parent, node, replacer)
  5309  	case *Literal:
  5310  		return a.rewriteRefOfLiteral(parent, node, replacer)
  5311  	case *MatchExpr:
  5312  		return a.rewriteRefOfMatchExpr(parent, node, replacer)
  5313  	case *NotExpr:
  5314  		return a.rewriteRefOfNotExpr(parent, node, replacer)
  5315  	case *NullVal:
  5316  		return a.rewriteRefOfNullVal(parent, node, replacer)
  5317  	case *OrExpr:
  5318  		return a.rewriteRefOfOrExpr(parent, node, replacer)
  5319  	case *Subquery:
  5320  		return a.rewriteRefOfSubquery(parent, node, replacer)
  5321  	case *SubstrExpr:
  5322  		return a.rewriteRefOfSubstrExpr(parent, node, replacer)
  5323  	case *TimestampFuncExpr:
  5324  		return a.rewriteRefOfTimestampFuncExpr(parent, node, replacer)
  5325  	case *UnaryExpr:
  5326  		return a.rewriteRefOfUnaryExpr(parent, node, replacer)
  5327  	case ValTuple:
  5328  		return a.rewriteValTuple(parent, node, replacer)
  5329  	case *ValuesFuncExpr:
  5330  		return a.rewriteRefOfValuesFuncExpr(parent, node, replacer)
  5331  	case *XorExpr:
  5332  		return a.rewriteRefOfXorExpr(parent, node, replacer)
  5333  	default:
  5334  		// this should never happen
  5335  		return true
  5336  	}
  5337  }
  5338  func (a *application) rewriteInsertRows(parent SQLNode, node InsertRows, replacer replacerFunc) bool {
  5339  	if node == nil {
  5340  		return true
  5341  	}
  5342  	switch node := node.(type) {
  5343  	case *Select:
  5344  		return a.rewriteRefOfSelect(parent, node, replacer)
  5345  	case *Union:
  5346  		return a.rewriteRefOfUnion(parent, node, replacer)
  5347  	case Values:
  5348  		return a.rewriteValues(parent, node, replacer)
  5349  	default:
  5350  		// this should never happen
  5351  		return true
  5352  	}
  5353  }
  5354  func (a *application) rewriteSelectExpr(parent SQLNode, node SelectExpr, replacer replacerFunc) bool {
  5355  	if node == nil {
  5356  		return true
  5357  	}
  5358  	switch node := node.(type) {
  5359  	case *AliasedExpr:
  5360  		return a.rewriteRefOfAliasedExpr(parent, node, replacer)
  5361  	case *Nextval:
  5362  		return a.rewriteRefOfNextval(parent, node, replacer)
  5363  	case *StarExpr:
  5364  		return a.rewriteRefOfStarExpr(parent, node, replacer)
  5365  	default:
  5366  		// this should never happen
  5367  		return true
  5368  	}
  5369  }
  5370  func (a *application) rewriteSelectStatement(parent SQLNode, node SelectStatement, replacer replacerFunc) bool {
  5371  	if node == nil {
  5372  		return true
  5373  	}
  5374  	switch node := node.(type) {
  5375  	case *Select:
  5376  		return a.rewriteRefOfSelect(parent, node, replacer)
  5377  	case *Union:
  5378  		return a.rewriteRefOfUnion(parent, node, replacer)
  5379  	default:
  5380  		// this should never happen
  5381  		return true
  5382  	}
  5383  }
  5384  func (a *application) rewriteShowInternal(parent SQLNode, node ShowInternal, replacer replacerFunc) bool {
  5385  	if node == nil {
  5386  		return true
  5387  	}
  5388  	switch node := node.(type) {
  5389  	case *ShowBasic:
  5390  		return a.rewriteRefOfShowBasic(parent, node, replacer)
  5391  	case *ShowCreate:
  5392  		return a.rewriteRefOfShowCreate(parent, node, replacer)
  5393  	case *ShowLegacy:
  5394  		return a.rewriteRefOfShowLegacy(parent, node, replacer)
  5395  	default:
  5396  		// this should never happen
  5397  		return true
  5398  	}
  5399  }
  5400  func (a *application) rewriteSimpleTableExpr(parent SQLNode, node SimpleTableExpr, replacer replacerFunc) bool {
  5401  	if node == nil {
  5402  		return true
  5403  	}
  5404  	switch node := node.(type) {
  5405  	case *DerivedTable:
  5406  		return a.rewriteRefOfDerivedTable(parent, node, replacer)
  5407  	case TableName:
  5408  		return a.rewriteTableName(parent, node, replacer)
  5409  	default:
  5410  		// this should never happen
  5411  		return true
  5412  	}
  5413  }
  5414  func (a *application) rewriteStatement(parent SQLNode, node Statement, replacer replacerFunc) bool {
  5415  	if node == nil {
  5416  		return true
  5417  	}
  5418  	switch node := node.(type) {
  5419  	case *AlterDatabase:
  5420  		return a.rewriteRefOfAlterDatabase(parent, node, replacer)
  5421  	case *AlterMigration:
  5422  		return a.rewriteRefOfAlterMigration(parent, node, replacer)
  5423  	case *AlterTable:
  5424  		return a.rewriteRefOfAlterTable(parent, node, replacer)
  5425  	case *AlterView:
  5426  		return a.rewriteRefOfAlterView(parent, node, replacer)
  5427  	case *AlterVschema:
  5428  		return a.rewriteRefOfAlterVschema(parent, node, replacer)
  5429  	case *Begin:
  5430  		return a.rewriteRefOfBegin(parent, node, replacer)
  5431  	case *CallProc:
  5432  		return a.rewriteRefOfCallProc(parent, node, replacer)
  5433  	case *Commit:
  5434  		return a.rewriteRefOfCommit(parent, node, replacer)
  5435  	case *CreateDatabase:
  5436  		return a.rewriteRefOfCreateDatabase(parent, node, replacer)
  5437  	case *CreateTable:
  5438  		return a.rewriteRefOfCreateTable(parent, node, replacer)
  5439  	case *CreateView:
  5440  		return a.rewriteRefOfCreateView(parent, node, replacer)
  5441  	case *Delete:
  5442  		return a.rewriteRefOfDelete(parent, node, replacer)
  5443  	case *DropDatabase:
  5444  		return a.rewriteRefOfDropDatabase(parent, node, replacer)
  5445  	case *DropTable:
  5446  		return a.rewriteRefOfDropTable(parent, node, replacer)
  5447  	case *DropView:
  5448  		return a.rewriteRefOfDropView(parent, node, replacer)
  5449  	case *ExplainStmt:
  5450  		return a.rewriteRefOfExplainStmt(parent, node, replacer)
  5451  	case *ExplainTab:
  5452  		return a.rewriteRefOfExplainTab(parent, node, replacer)
  5453  	case *Flush:
  5454  		return a.rewriteRefOfFlush(parent, node, replacer)
  5455  	case *Insert:
  5456  		return a.rewriteRefOfInsert(parent, node, replacer)
  5457  	case *Load:
  5458  		return a.rewriteRefOfLoad(parent, node, replacer)
  5459  	case *LockTables:
  5460  		return a.rewriteRefOfLockTables(parent, node, replacer)
  5461  	case *OtherAdmin:
  5462  		return a.rewriteRefOfOtherAdmin(parent, node, replacer)
  5463  	case *OtherRead:
  5464  		return a.rewriteRefOfOtherRead(parent, node, replacer)
  5465  	case *Release:
  5466  		return a.rewriteRefOfRelease(parent, node, replacer)
  5467  	case *RenameTable:
  5468  		return a.rewriteRefOfRenameTable(parent, node, replacer)
  5469  	case *RevertMigration:
  5470  		return a.rewriteRefOfRevertMigration(parent, node, replacer)
  5471  	case *Rollback:
  5472  		return a.rewriteRefOfRollback(parent, node, replacer)
  5473  	case *SRollback:
  5474  		return a.rewriteRefOfSRollback(parent, node, replacer)
  5475  	case *Savepoint:
  5476  		return a.rewriteRefOfSavepoint(parent, node, replacer)
  5477  	case *Select:
  5478  		return a.rewriteRefOfSelect(parent, node, replacer)
  5479  	case *Set:
  5480  		return a.rewriteRefOfSet(parent, node, replacer)
  5481  	case *SetTransaction:
  5482  		return a.rewriteRefOfSetTransaction(parent, node, replacer)
  5483  	case *Show:
  5484  		return a.rewriteRefOfShow(parent, node, replacer)
  5485  	case *ShowMigrationLogs:
  5486  		return a.rewriteRefOfShowMigrationLogs(parent, node, replacer)
  5487  	case *Stream:
  5488  		return a.rewriteRefOfStream(parent, node, replacer)
  5489  	case *TruncateTable:
  5490  		return a.rewriteRefOfTruncateTable(parent, node, replacer)
  5491  	case *Union:
  5492  		return a.rewriteRefOfUnion(parent, node, replacer)
  5493  	case *UnlockTables:
  5494  		return a.rewriteRefOfUnlockTables(parent, node, replacer)
  5495  	case *Update:
  5496  		return a.rewriteRefOfUpdate(parent, node, replacer)
  5497  	case *Use:
  5498  		return a.rewriteRefOfUse(parent, node, replacer)
  5499  	case *VStream:
  5500  		return a.rewriteRefOfVStream(parent, node, replacer)
  5501  	default:
  5502  		// this should never happen
  5503  		return true
  5504  	}
  5505  }
  5506  func (a *application) rewriteTableExpr(parent SQLNode, node TableExpr, replacer replacerFunc) bool {
  5507  	if node == nil {
  5508  		return true
  5509  	}
  5510  	switch node := node.(type) {
  5511  	case *AliasedTableExpr:
  5512  		return a.rewriteRefOfAliasedTableExpr(parent, node, replacer)
  5513  	case *JoinTableExpr:
  5514  		return a.rewriteRefOfJoinTableExpr(parent, node, replacer)
  5515  	case *ParenTableExpr:
  5516  		return a.rewriteRefOfParenTableExpr(parent, node, replacer)
  5517  	default:
  5518  		// this should never happen
  5519  		return true
  5520  	}
  5521  }
  5522  func (a *application) rewriteAccessMode(parent SQLNode, node AccessMode, replacer replacerFunc) bool {
  5523  	if a.pre != nil {
  5524  		a.cur.replacer = replacer
  5525  		a.cur.parent = parent
  5526  		a.cur.node = node
  5527  		if !a.pre(&a.cur) {
  5528  			return true
  5529  		}
  5530  	}
  5531  	if a.post != nil {
  5532  		if a.pre == nil {
  5533  			a.cur.replacer = replacer
  5534  			a.cur.parent = parent
  5535  			a.cur.node = node
  5536  		}
  5537  		if !a.post(&a.cur) {
  5538  			return false
  5539  		}
  5540  	}
  5541  	return true
  5542  }
  5543  func (a *application) rewriteAlgorithmValue(parent SQLNode, node AlgorithmValue, replacer replacerFunc) bool {
  5544  	if a.pre != nil {
  5545  		a.cur.replacer = replacer
  5546  		a.cur.parent = parent
  5547  		a.cur.node = node
  5548  		if !a.pre(&a.cur) {
  5549  			return true
  5550  		}
  5551  	}
  5552  	if a.post != nil {
  5553  		if a.pre == nil {
  5554  			a.cur.replacer = replacer
  5555  			a.cur.parent = parent
  5556  			a.cur.node = node
  5557  		}
  5558  		if !a.post(&a.cur) {
  5559  			return false
  5560  		}
  5561  	}
  5562  	return true
  5563  }
  5564  func (a *application) rewriteArgument(parent SQLNode, node Argument, replacer replacerFunc) bool {
  5565  	if a.pre != nil {
  5566  		a.cur.replacer = replacer
  5567  		a.cur.parent = parent
  5568  		a.cur.node = node
  5569  		if !a.pre(&a.cur) {
  5570  			return true
  5571  		}
  5572  	}
  5573  	if a.post != nil {
  5574  		if a.pre == nil {
  5575  			a.cur.replacer = replacer
  5576  			a.cur.parent = parent
  5577  			a.cur.node = node
  5578  		}
  5579  		if !a.post(&a.cur) {
  5580  			return false
  5581  		}
  5582  	}
  5583  	return true
  5584  }
  5585  func (a *application) rewriteBoolVal(parent SQLNode, node BoolVal, replacer replacerFunc) bool {
  5586  	if a.pre != nil {
  5587  		a.cur.replacer = replacer
  5588  		a.cur.parent = parent
  5589  		a.cur.node = node
  5590  		if !a.pre(&a.cur) {
  5591  			return true
  5592  		}
  5593  	}
  5594  	if a.post != nil {
  5595  		if a.pre == nil {
  5596  			a.cur.replacer = replacer
  5597  			a.cur.parent = parent
  5598  			a.cur.node = node
  5599  		}
  5600  		if !a.post(&a.cur) {
  5601  			return false
  5602  		}
  5603  	}
  5604  	return true
  5605  }
  5606  func (a *application) rewriteIsolationLevel(parent SQLNode, node IsolationLevel, replacer replacerFunc) bool {
  5607  	if a.pre != nil {
  5608  		a.cur.replacer = replacer
  5609  		a.cur.parent = parent
  5610  		a.cur.node = node
  5611  		if !a.pre(&a.cur) {
  5612  			return true
  5613  		}
  5614  	}
  5615  	if a.post != nil {
  5616  		if a.pre == nil {
  5617  			a.cur.replacer = replacer
  5618  			a.cur.parent = parent
  5619  			a.cur.node = node
  5620  		}
  5621  		if !a.post(&a.cur) {
  5622  			return false
  5623  		}
  5624  	}
  5625  	return true
  5626  }
  5627  func (a *application) rewriteListArg(parent SQLNode, node ListArg, replacer replacerFunc) bool {
  5628  	if a.pre != nil {
  5629  		a.cur.replacer = replacer
  5630  		a.cur.parent = parent
  5631  		a.cur.node = node
  5632  		if !a.pre(&a.cur) {
  5633  			return true
  5634  		}
  5635  	}
  5636  	if a.post != nil {
  5637  		if a.pre == nil {
  5638  			a.cur.replacer = replacer
  5639  			a.cur.parent = parent
  5640  			a.cur.node = node
  5641  		}
  5642  		if !a.post(&a.cur) {
  5643  			return false
  5644  		}
  5645  	}
  5646  	return true
  5647  }
  5648  func (a *application) rewriteReferenceAction(parent SQLNode, node ReferenceAction, replacer replacerFunc) bool {
  5649  	if a.pre != nil {
  5650  		a.cur.replacer = replacer
  5651  		a.cur.parent = parent
  5652  		a.cur.node = node
  5653  		if !a.pre(&a.cur) {
  5654  			return true
  5655  		}
  5656  	}
  5657  	if a.post != nil {
  5658  		if a.pre == nil {
  5659  			a.cur.replacer = replacer
  5660  			a.cur.parent = parent
  5661  			a.cur.node = node
  5662  		}
  5663  		if !a.post(&a.cur) {
  5664  			return false
  5665  		}
  5666  	}
  5667  	return true
  5668  }
  5669  func (a *application) rewriteRefOfColIdent(parent SQLNode, node *ColIdent, replacer replacerFunc) bool {
  5670  	if node == nil {
  5671  		return true
  5672  	}
  5673  	if a.pre != nil {
  5674  		a.cur.replacer = replacer
  5675  		a.cur.parent = parent
  5676  		a.cur.node = node
  5677  		if !a.pre(&a.cur) {
  5678  			return true
  5679  		}
  5680  	}
  5681  	if a.post != nil {
  5682  		if a.pre == nil {
  5683  			a.cur.replacer = replacer
  5684  			a.cur.parent = parent
  5685  			a.cur.node = node
  5686  		}
  5687  		if !a.post(&a.cur) {
  5688  			return false
  5689  		}
  5690  	}
  5691  	return true
  5692  }
  5693  func (a *application) rewriteRefOfRootNode(parent SQLNode, node *RootNode, replacer replacerFunc) bool {
  5694  	if node == nil {
  5695  		return true
  5696  	}
  5697  	if a.pre != nil {
  5698  		a.cur.replacer = replacer
  5699  		a.cur.parent = parent
  5700  		a.cur.node = node
  5701  		if !a.pre(&a.cur) {
  5702  			return true
  5703  		}
  5704  	}
  5705  	if !a.rewriteSQLNode(node, node.SQLNode, func(newNode, parent SQLNode) {
  5706  		parent.(*RootNode).SQLNode = newNode.(SQLNode)
  5707  	}) {
  5708  		return false
  5709  	}
  5710  	if a.post != nil {
  5711  		a.cur.replacer = replacer
  5712  		a.cur.parent = parent
  5713  		a.cur.node = node
  5714  		if !a.post(&a.cur) {
  5715  			return false
  5716  		}
  5717  	}
  5718  	return true
  5719  }
  5720  func (a *application) rewriteRefOfTableIdent(parent SQLNode, node *TableIdent, replacer replacerFunc) bool {
  5721  	if node == nil {
  5722  		return true
  5723  	}
  5724  	if a.pre != nil {
  5725  		a.cur.replacer = replacer
  5726  		a.cur.parent = parent
  5727  		a.cur.node = node
  5728  		if !a.pre(&a.cur) {
  5729  			return true
  5730  		}
  5731  	}
  5732  	if a.post != nil {
  5733  		if a.pre == nil {
  5734  			a.cur.replacer = replacer
  5735  			a.cur.parent = parent
  5736  			a.cur.node = node
  5737  		}
  5738  		if !a.post(&a.cur) {
  5739  			return false
  5740  		}
  5741  	}
  5742  	return true
  5743  }
  5744  func (a *application) rewriteRefOfTableName(parent SQLNode, node *TableName, replacer replacerFunc) bool {
  5745  	if node == nil {
  5746  		return true
  5747  	}
  5748  	if a.pre != nil {
  5749  		a.cur.replacer = replacer
  5750  		a.cur.parent = parent
  5751  		a.cur.node = node
  5752  		if !a.pre(&a.cur) {
  5753  			return true
  5754  		}
  5755  	}
  5756  	if !a.rewriteTableIdent(node, node.Name, func(newNode, parent SQLNode) {
  5757  		parent.(*TableName).Name = newNode.(TableIdent)
  5758  	}) {
  5759  		return false
  5760  	}
  5761  	if !a.rewriteTableIdent(node, node.Qualifier, func(newNode, parent SQLNode) {
  5762  		parent.(*TableName).Qualifier = newNode.(TableIdent)
  5763  	}) {
  5764  		return false
  5765  	}
  5766  	if a.post != nil {
  5767  		a.cur.replacer = replacer
  5768  		a.cur.parent = parent
  5769  		a.cur.node = node
  5770  		if !a.post(&a.cur) {
  5771  			return false
  5772  		}
  5773  	}
  5774  	return true
  5775  }
  5776  func (a *application) rewriteRefOfVindexParam(parent SQLNode, node *VindexParam, replacer replacerFunc) bool {
  5777  	if node == nil {
  5778  		return true
  5779  	}
  5780  	if a.pre != nil {
  5781  		a.cur.replacer = replacer
  5782  		a.cur.parent = parent
  5783  		a.cur.node = node
  5784  		if !a.pre(&a.cur) {
  5785  			return true
  5786  		}
  5787  	}
  5788  	if !a.rewriteColIdent(node, node.Key, func(newNode, parent SQLNode) {
  5789  		parent.(*VindexParam).Key = newNode.(ColIdent)
  5790  	}) {
  5791  		return false
  5792  	}
  5793  	if a.post != nil {
  5794  		a.cur.replacer = replacer
  5795  		a.cur.parent = parent
  5796  		a.cur.node = node
  5797  		if !a.post(&a.cur) {
  5798  			return false
  5799  		}
  5800  	}
  5801  	return true
  5802  }