github.com/vedadiyan/sqlparser@v1.0.0/pkg/sqlparser/ast_copy_on_rewrite.go (about)

     1  /*
     2  Copyright 2023 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 (c *cow) copyOnRewriteSQLNode(n SQLNode, parent SQLNode) (out SQLNode, changed bool) {
    21  	if n == nil || c.cursor.stop {
    22  		return n, false
    23  	}
    24  	switch n := n.(type) {
    25  	case *AddColumns:
    26  		return c.copyOnRewriteRefOfAddColumns(n, parent)
    27  	case *AddConstraintDefinition:
    28  		return c.copyOnRewriteRefOfAddConstraintDefinition(n, parent)
    29  	case *AddIndexDefinition:
    30  		return c.copyOnRewriteRefOfAddIndexDefinition(n, parent)
    31  	case AlgorithmValue:
    32  		return c.copyOnRewriteAlgorithmValue(n, parent)
    33  	case *AliasedExpr:
    34  		return c.copyOnRewriteRefOfAliasedExpr(n, parent)
    35  	case *AliasedTableExpr:
    36  		return c.copyOnRewriteRefOfAliasedTableExpr(n, parent)
    37  	case *AlterCharset:
    38  		return c.copyOnRewriteRefOfAlterCharset(n, parent)
    39  	case *AlterCheck:
    40  		return c.copyOnRewriteRefOfAlterCheck(n, parent)
    41  	case *AlterColumn:
    42  		return c.copyOnRewriteRefOfAlterColumn(n, parent)
    43  	case *AlterDatabase:
    44  		return c.copyOnRewriteRefOfAlterDatabase(n, parent)
    45  	case *AlterIndex:
    46  		return c.copyOnRewriteRefOfAlterIndex(n, parent)
    47  	case *AlterMigration:
    48  		return c.copyOnRewriteRefOfAlterMigration(n, parent)
    49  	case *AlterTable:
    50  		return c.copyOnRewriteRefOfAlterTable(n, parent)
    51  	case *AlterView:
    52  		return c.copyOnRewriteRefOfAlterView(n, parent)
    53  	case *AlterVschema:
    54  		return c.copyOnRewriteRefOfAlterVschema(n, parent)
    55  	case *AndExpr:
    56  		return c.copyOnRewriteRefOfAndExpr(n, parent)
    57  	case Argument:
    58  		return c.copyOnRewriteArgument(n, parent)
    59  	case *ArgumentLessWindowExpr:
    60  		return c.copyOnRewriteRefOfArgumentLessWindowExpr(n, parent)
    61  	case *AutoIncSpec:
    62  		return c.copyOnRewriteRefOfAutoIncSpec(n, parent)
    63  	case *Avg:
    64  		return c.copyOnRewriteRefOfAvg(n, parent)
    65  	case *Begin:
    66  		return c.copyOnRewriteRefOfBegin(n, parent)
    67  	case *BetweenExpr:
    68  		return c.copyOnRewriteRefOfBetweenExpr(n, parent)
    69  	case *BinaryExpr:
    70  		return c.copyOnRewriteRefOfBinaryExpr(n, parent)
    71  	case *BitAnd:
    72  		return c.copyOnRewriteRefOfBitAnd(n, parent)
    73  	case *BitOr:
    74  		return c.copyOnRewriteRefOfBitOr(n, parent)
    75  	case *BitXor:
    76  		return c.copyOnRewriteRefOfBitXor(n, parent)
    77  	case BoolVal:
    78  		return c.copyOnRewriteBoolVal(n, parent)
    79  	case *CallProc:
    80  		return c.copyOnRewriteRefOfCallProc(n, parent)
    81  	case *CaseExpr:
    82  		return c.copyOnRewriteRefOfCaseExpr(n, parent)
    83  	case *CastExpr:
    84  		return c.copyOnRewriteRefOfCastExpr(n, parent)
    85  	case *ChangeColumn:
    86  		return c.copyOnRewriteRefOfChangeColumn(n, parent)
    87  	case *CharExpr:
    88  		return c.copyOnRewriteRefOfCharExpr(n, parent)
    89  	case *CheckConstraintDefinition:
    90  		return c.copyOnRewriteRefOfCheckConstraintDefinition(n, parent)
    91  	case *ColName:
    92  		return c.copyOnRewriteRefOfColName(n, parent)
    93  	case *CollateExpr:
    94  		return c.copyOnRewriteRefOfCollateExpr(n, parent)
    95  	case *ColumnDefinition:
    96  		return c.copyOnRewriteRefOfColumnDefinition(n, parent)
    97  	case *ColumnType:
    98  		return c.copyOnRewriteRefOfColumnType(n, parent)
    99  	case Columns:
   100  		return c.copyOnRewriteColumns(n, parent)
   101  	case *CommentOnly:
   102  		return c.copyOnRewriteRefOfCommentOnly(n, parent)
   103  	case *Commit:
   104  		return c.copyOnRewriteRefOfCommit(n, parent)
   105  	case *CommonTableExpr:
   106  		return c.copyOnRewriteRefOfCommonTableExpr(n, parent)
   107  	case *ComparisonExpr:
   108  		return c.copyOnRewriteRefOfComparisonExpr(n, parent)
   109  	case *ConstraintDefinition:
   110  		return c.copyOnRewriteRefOfConstraintDefinition(n, parent)
   111  	case *ConvertExpr:
   112  		return c.copyOnRewriteRefOfConvertExpr(n, parent)
   113  	case *ConvertType:
   114  		return c.copyOnRewriteRefOfConvertType(n, parent)
   115  	case *ConvertUsingExpr:
   116  		return c.copyOnRewriteRefOfConvertUsingExpr(n, parent)
   117  	case *Count:
   118  		return c.copyOnRewriteRefOfCount(n, parent)
   119  	case *CountStar:
   120  		return c.copyOnRewriteRefOfCountStar(n, parent)
   121  	case *CreateDatabase:
   122  		return c.copyOnRewriteRefOfCreateDatabase(n, parent)
   123  	case *CreateTable:
   124  		return c.copyOnRewriteRefOfCreateTable(n, parent)
   125  	case *CreateView:
   126  		return c.copyOnRewriteRefOfCreateView(n, parent)
   127  	case *CurTimeFuncExpr:
   128  		return c.copyOnRewriteRefOfCurTimeFuncExpr(n, parent)
   129  	case *DeallocateStmt:
   130  		return c.copyOnRewriteRefOfDeallocateStmt(n, parent)
   131  	case *Default:
   132  		return c.copyOnRewriteRefOfDefault(n, parent)
   133  	case *Definer:
   134  		return c.copyOnRewriteRefOfDefiner(n, parent)
   135  	case *Delete:
   136  		return c.copyOnRewriteRefOfDelete(n, parent)
   137  	case *DerivedTable:
   138  		return c.copyOnRewriteRefOfDerivedTable(n, parent)
   139  	case *DropColumn:
   140  		return c.copyOnRewriteRefOfDropColumn(n, parent)
   141  	case *DropDatabase:
   142  		return c.copyOnRewriteRefOfDropDatabase(n, parent)
   143  	case *DropKey:
   144  		return c.copyOnRewriteRefOfDropKey(n, parent)
   145  	case *DropTable:
   146  		return c.copyOnRewriteRefOfDropTable(n, parent)
   147  	case *DropView:
   148  		return c.copyOnRewriteRefOfDropView(n, parent)
   149  	case *ExecuteStmt:
   150  		return c.copyOnRewriteRefOfExecuteStmt(n, parent)
   151  	case *ExistsExpr:
   152  		return c.copyOnRewriteRefOfExistsExpr(n, parent)
   153  	case *ExplainStmt:
   154  		return c.copyOnRewriteRefOfExplainStmt(n, parent)
   155  	case *ExplainTab:
   156  		return c.copyOnRewriteRefOfExplainTab(n, parent)
   157  	case Exprs:
   158  		return c.copyOnRewriteExprs(n, parent)
   159  	case *ExtractFuncExpr:
   160  		return c.copyOnRewriteRefOfExtractFuncExpr(n, parent)
   161  	case *ExtractValueExpr:
   162  		return c.copyOnRewriteRefOfExtractValueExpr(n, parent)
   163  	case *ExtractedSubquery:
   164  		return c.copyOnRewriteRefOfExtractedSubquery(n, parent)
   165  	case *FirstOrLastValueExpr:
   166  		return c.copyOnRewriteRefOfFirstOrLastValueExpr(n, parent)
   167  	case *Flush:
   168  		return c.copyOnRewriteRefOfFlush(n, parent)
   169  	case *Force:
   170  		return c.copyOnRewriteRefOfForce(n, parent)
   171  	case *ForeignKeyDefinition:
   172  		return c.copyOnRewriteRefOfForeignKeyDefinition(n, parent)
   173  	case *FrameClause:
   174  		return c.copyOnRewriteRefOfFrameClause(n, parent)
   175  	case *FramePoint:
   176  		return c.copyOnRewriteRefOfFramePoint(n, parent)
   177  	case *FromFirstLastClause:
   178  		return c.copyOnRewriteRefOfFromFirstLastClause(n, parent)
   179  	case *FuncExpr:
   180  		return c.copyOnRewriteRefOfFuncExpr(n, parent)
   181  	case *GTIDFuncExpr:
   182  		return c.copyOnRewriteRefOfGTIDFuncExpr(n, parent)
   183  	case GroupBy:
   184  		return c.copyOnRewriteGroupBy(n, parent)
   185  	case *GroupConcatExpr:
   186  		return c.copyOnRewriteRefOfGroupConcatExpr(n, parent)
   187  	case IdentifierCI:
   188  		return c.copyOnRewriteIdentifierCI(n, parent)
   189  	case IdentifierCS:
   190  		return c.copyOnRewriteIdentifierCS(n, parent)
   191  	case *IndexDefinition:
   192  		return c.copyOnRewriteRefOfIndexDefinition(n, parent)
   193  	case *IndexHint:
   194  		return c.copyOnRewriteRefOfIndexHint(n, parent)
   195  	case IndexHints:
   196  		return c.copyOnRewriteIndexHints(n, parent)
   197  	case *IndexInfo:
   198  		return c.copyOnRewriteRefOfIndexInfo(n, parent)
   199  	case *Insert:
   200  		return c.copyOnRewriteRefOfInsert(n, parent)
   201  	case *InsertExpr:
   202  		return c.copyOnRewriteRefOfInsertExpr(n, parent)
   203  	case *IntervalExpr:
   204  		return c.copyOnRewriteRefOfIntervalExpr(n, parent)
   205  	case *IntervalFuncExpr:
   206  		return c.copyOnRewriteRefOfIntervalFuncExpr(n, parent)
   207  	case *IntroducerExpr:
   208  		return c.copyOnRewriteRefOfIntroducerExpr(n, parent)
   209  	case *IsExpr:
   210  		return c.copyOnRewriteRefOfIsExpr(n, parent)
   211  	case *JSONArrayExpr:
   212  		return c.copyOnRewriteRefOfJSONArrayExpr(n, parent)
   213  	case *JSONAttributesExpr:
   214  		return c.copyOnRewriteRefOfJSONAttributesExpr(n, parent)
   215  	case *JSONContainsExpr:
   216  		return c.copyOnRewriteRefOfJSONContainsExpr(n, parent)
   217  	case *JSONContainsPathExpr:
   218  		return c.copyOnRewriteRefOfJSONContainsPathExpr(n, parent)
   219  	case *JSONExtractExpr:
   220  		return c.copyOnRewriteRefOfJSONExtractExpr(n, parent)
   221  	case *JSONKeysExpr:
   222  		return c.copyOnRewriteRefOfJSONKeysExpr(n, parent)
   223  	case *JSONObjectExpr:
   224  		return c.copyOnRewriteRefOfJSONObjectExpr(n, parent)
   225  	case *JSONObjectParam:
   226  		return c.copyOnRewriteRefOfJSONObjectParam(n, parent)
   227  	case *JSONOverlapsExpr:
   228  		return c.copyOnRewriteRefOfJSONOverlapsExpr(n, parent)
   229  	case *JSONPrettyExpr:
   230  		return c.copyOnRewriteRefOfJSONPrettyExpr(n, parent)
   231  	case *JSONQuoteExpr:
   232  		return c.copyOnRewriteRefOfJSONQuoteExpr(n, parent)
   233  	case *JSONRemoveExpr:
   234  		return c.copyOnRewriteRefOfJSONRemoveExpr(n, parent)
   235  	case *JSONSchemaValidFuncExpr:
   236  		return c.copyOnRewriteRefOfJSONSchemaValidFuncExpr(n, parent)
   237  	case *JSONSchemaValidationReportFuncExpr:
   238  		return c.copyOnRewriteRefOfJSONSchemaValidationReportFuncExpr(n, parent)
   239  	case *JSONSearchExpr:
   240  		return c.copyOnRewriteRefOfJSONSearchExpr(n, parent)
   241  	case *JSONStorageFreeExpr:
   242  		return c.copyOnRewriteRefOfJSONStorageFreeExpr(n, parent)
   243  	case *JSONStorageSizeExpr:
   244  		return c.copyOnRewriteRefOfJSONStorageSizeExpr(n, parent)
   245  	case *JSONTableExpr:
   246  		return c.copyOnRewriteRefOfJSONTableExpr(n, parent)
   247  	case *JSONUnquoteExpr:
   248  		return c.copyOnRewriteRefOfJSONUnquoteExpr(n, parent)
   249  	case *JSONValueExpr:
   250  		return c.copyOnRewriteRefOfJSONValueExpr(n, parent)
   251  	case *JSONValueMergeExpr:
   252  		return c.copyOnRewriteRefOfJSONValueMergeExpr(n, parent)
   253  	case *JSONValueModifierExpr:
   254  		return c.copyOnRewriteRefOfJSONValueModifierExpr(n, parent)
   255  	case *JoinCondition:
   256  		return c.copyOnRewriteRefOfJoinCondition(n, parent)
   257  	case *JoinTableExpr:
   258  		return c.copyOnRewriteRefOfJoinTableExpr(n, parent)
   259  	case *JtColumnDefinition:
   260  		return c.copyOnRewriteRefOfJtColumnDefinition(n, parent)
   261  	case *JtOnResponse:
   262  		return c.copyOnRewriteRefOfJtOnResponse(n, parent)
   263  	case *KeyState:
   264  		return c.copyOnRewriteRefOfKeyState(n, parent)
   265  	case *LagLeadExpr:
   266  		return c.copyOnRewriteRefOfLagLeadExpr(n, parent)
   267  	case *Limit:
   268  		return c.copyOnRewriteRefOfLimit(n, parent)
   269  	case *LineStringExpr:
   270  		return c.copyOnRewriteRefOfLineStringExpr(n, parent)
   271  	case ListArg:
   272  		return c.copyOnRewriteListArg(n, parent)
   273  	case *Literal:
   274  		return c.copyOnRewriteRefOfLiteral(n, parent)
   275  	case *Load:
   276  		return c.copyOnRewriteRefOfLoad(n, parent)
   277  	case *LocateExpr:
   278  		return c.copyOnRewriteRefOfLocateExpr(n, parent)
   279  	case *LockOption:
   280  		return c.copyOnRewriteRefOfLockOption(n, parent)
   281  	case *LockTables:
   282  		return c.copyOnRewriteRefOfLockTables(n, parent)
   283  	case *LockingFunc:
   284  		return c.copyOnRewriteRefOfLockingFunc(n, parent)
   285  	case MatchAction:
   286  		return c.copyOnRewriteMatchAction(n, parent)
   287  	case *MatchExpr:
   288  		return c.copyOnRewriteRefOfMatchExpr(n, parent)
   289  	case *Max:
   290  		return c.copyOnRewriteRefOfMax(n, parent)
   291  	case *MemberOfExpr:
   292  		return c.copyOnRewriteRefOfMemberOfExpr(n, parent)
   293  	case *Min:
   294  		return c.copyOnRewriteRefOfMin(n, parent)
   295  	case *ModifyColumn:
   296  		return c.copyOnRewriteRefOfModifyColumn(n, parent)
   297  	case *NTHValueExpr:
   298  		return c.copyOnRewriteRefOfNTHValueExpr(n, parent)
   299  	case *NamedWindow:
   300  		return c.copyOnRewriteRefOfNamedWindow(n, parent)
   301  	case NamedWindows:
   302  		return c.copyOnRewriteNamedWindows(n, parent)
   303  	case *Nextval:
   304  		return c.copyOnRewriteRefOfNextval(n, parent)
   305  	case *NotExpr:
   306  		return c.copyOnRewriteRefOfNotExpr(n, parent)
   307  	case *NtileExpr:
   308  		return c.copyOnRewriteRefOfNtileExpr(n, parent)
   309  	case *NullTreatmentClause:
   310  		return c.copyOnRewriteRefOfNullTreatmentClause(n, parent)
   311  	case *NullVal:
   312  		return c.copyOnRewriteRefOfNullVal(n, parent)
   313  	case *Offset:
   314  		return c.copyOnRewriteRefOfOffset(n, parent)
   315  	case OnDup:
   316  		return c.copyOnRewriteOnDup(n, parent)
   317  	case *OptLike:
   318  		return c.copyOnRewriteRefOfOptLike(n, parent)
   319  	case *OrExpr:
   320  		return c.copyOnRewriteRefOfOrExpr(n, parent)
   321  	case *Order:
   322  		return c.copyOnRewriteRefOfOrder(n, parent)
   323  	case OrderBy:
   324  		return c.copyOnRewriteOrderBy(n, parent)
   325  	case *OrderByOption:
   326  		return c.copyOnRewriteRefOfOrderByOption(n, parent)
   327  	case *OtherAdmin:
   328  		return c.copyOnRewriteRefOfOtherAdmin(n, parent)
   329  	case *OtherRead:
   330  		return c.copyOnRewriteRefOfOtherRead(n, parent)
   331  	case *OverClause:
   332  		return c.copyOnRewriteRefOfOverClause(n, parent)
   333  	case *ParenTableExpr:
   334  		return c.copyOnRewriteRefOfParenTableExpr(n, parent)
   335  	case *ParsedComments:
   336  		return c.copyOnRewriteRefOfParsedComments(n, parent)
   337  	case *PartitionDefinition:
   338  		return c.copyOnRewriteRefOfPartitionDefinition(n, parent)
   339  	case *PartitionDefinitionOptions:
   340  		return c.copyOnRewriteRefOfPartitionDefinitionOptions(n, parent)
   341  	case *PartitionEngine:
   342  		return c.copyOnRewriteRefOfPartitionEngine(n, parent)
   343  	case *PartitionOption:
   344  		return c.copyOnRewriteRefOfPartitionOption(n, parent)
   345  	case *PartitionSpec:
   346  		return c.copyOnRewriteRefOfPartitionSpec(n, parent)
   347  	case *PartitionValueRange:
   348  		return c.copyOnRewriteRefOfPartitionValueRange(n, parent)
   349  	case Partitions:
   350  		return c.copyOnRewritePartitions(n, parent)
   351  	case *PerformanceSchemaFuncExpr:
   352  		return c.copyOnRewriteRefOfPerformanceSchemaFuncExpr(n, parent)
   353  	case *PointExpr:
   354  		return c.copyOnRewriteRefOfPointExpr(n, parent)
   355  	case *PrepareStmt:
   356  		return c.copyOnRewriteRefOfPrepareStmt(n, parent)
   357  	case ReferenceAction:
   358  		return c.copyOnRewriteReferenceAction(n, parent)
   359  	case *ReferenceDefinition:
   360  		return c.copyOnRewriteRefOfReferenceDefinition(n, parent)
   361  	case *RegexpInstrExpr:
   362  		return c.copyOnRewriteRefOfRegexpInstrExpr(n, parent)
   363  	case *RegexpLikeExpr:
   364  		return c.copyOnRewriteRefOfRegexpLikeExpr(n, parent)
   365  	case *RegexpReplaceExpr:
   366  		return c.copyOnRewriteRefOfRegexpReplaceExpr(n, parent)
   367  	case *RegexpSubstrExpr:
   368  		return c.copyOnRewriteRefOfRegexpSubstrExpr(n, parent)
   369  	case *Release:
   370  		return c.copyOnRewriteRefOfRelease(n, parent)
   371  	case *RenameColumn:
   372  		return c.copyOnRewriteRefOfRenameColumn(n, parent)
   373  	case *RenameIndex:
   374  		return c.copyOnRewriteRefOfRenameIndex(n, parent)
   375  	case *RenameTable:
   376  		return c.copyOnRewriteRefOfRenameTable(n, parent)
   377  	case *RenameTableName:
   378  		return c.copyOnRewriteRefOfRenameTableName(n, parent)
   379  	case *RevertMigration:
   380  		return c.copyOnRewriteRefOfRevertMigration(n, parent)
   381  	case *Rollback:
   382  		return c.copyOnRewriteRefOfRollback(n, parent)
   383  	case RootNode:
   384  		return c.copyOnRewriteRootNode(n, parent)
   385  	case *SRollback:
   386  		return c.copyOnRewriteRefOfSRollback(n, parent)
   387  	case *Savepoint:
   388  		return c.copyOnRewriteRefOfSavepoint(n, parent)
   389  	case *Select:
   390  		return c.copyOnRewriteRefOfSelect(n, parent)
   391  	case SelectExprs:
   392  		return c.copyOnRewriteSelectExprs(n, parent)
   393  	case *SelectInto:
   394  		return c.copyOnRewriteRefOfSelectInto(n, parent)
   395  	case *Set:
   396  		return c.copyOnRewriteRefOfSet(n, parent)
   397  	case *SetExpr:
   398  		return c.copyOnRewriteRefOfSetExpr(n, parent)
   399  	case SetExprs:
   400  		return c.copyOnRewriteSetExprs(n, parent)
   401  	case *Show:
   402  		return c.copyOnRewriteRefOfShow(n, parent)
   403  	case *ShowBasic:
   404  		return c.copyOnRewriteRefOfShowBasic(n, parent)
   405  	case *ShowCreate:
   406  		return c.copyOnRewriteRefOfShowCreate(n, parent)
   407  	case *ShowFilter:
   408  		return c.copyOnRewriteRefOfShowFilter(n, parent)
   409  	case *ShowMigrationLogs:
   410  		return c.copyOnRewriteRefOfShowMigrationLogs(n, parent)
   411  	case *ShowOther:
   412  		return c.copyOnRewriteRefOfShowOther(n, parent)
   413  	case *ShowThrottledApps:
   414  		return c.copyOnRewriteRefOfShowThrottledApps(n, parent)
   415  	case *ShowThrottlerStatus:
   416  		return c.copyOnRewriteRefOfShowThrottlerStatus(n, parent)
   417  	case *StarExpr:
   418  		return c.copyOnRewriteRefOfStarExpr(n, parent)
   419  	case *Std:
   420  		return c.copyOnRewriteRefOfStd(n, parent)
   421  	case *StdDev:
   422  		return c.copyOnRewriteRefOfStdDev(n, parent)
   423  	case *StdPop:
   424  		return c.copyOnRewriteRefOfStdPop(n, parent)
   425  	case *StdSamp:
   426  		return c.copyOnRewriteRefOfStdSamp(n, parent)
   427  	case *Stream:
   428  		return c.copyOnRewriteRefOfStream(n, parent)
   429  	case *SubPartition:
   430  		return c.copyOnRewriteRefOfSubPartition(n, parent)
   431  	case *SubPartitionDefinition:
   432  		return c.copyOnRewriteRefOfSubPartitionDefinition(n, parent)
   433  	case *SubPartitionDefinitionOptions:
   434  		return c.copyOnRewriteRefOfSubPartitionDefinitionOptions(n, parent)
   435  	case SubPartitionDefinitions:
   436  		return c.copyOnRewriteSubPartitionDefinitions(n, parent)
   437  	case *Subquery:
   438  		return c.copyOnRewriteRefOfSubquery(n, parent)
   439  	case *SubstrExpr:
   440  		return c.copyOnRewriteRefOfSubstrExpr(n, parent)
   441  	case *Sum:
   442  		return c.copyOnRewriteRefOfSum(n, parent)
   443  	case TableExprs:
   444  		return c.copyOnRewriteTableExprs(n, parent)
   445  	case TableName:
   446  		return c.copyOnRewriteTableName(n, parent)
   447  	case TableNames:
   448  		return c.copyOnRewriteTableNames(n, parent)
   449  	case TableOptions:
   450  		return c.copyOnRewriteTableOptions(n, parent)
   451  	case *TableSpec:
   452  		return c.copyOnRewriteRefOfTableSpec(n, parent)
   453  	case *TablespaceOperation:
   454  		return c.copyOnRewriteRefOfTablespaceOperation(n, parent)
   455  	case *TimestampFuncExpr:
   456  		return c.copyOnRewriteRefOfTimestampFuncExpr(n, parent)
   457  	case *TrimFuncExpr:
   458  		return c.copyOnRewriteRefOfTrimFuncExpr(n, parent)
   459  	case *TruncateTable:
   460  		return c.copyOnRewriteRefOfTruncateTable(n, parent)
   461  	case *UnaryExpr:
   462  		return c.copyOnRewriteRefOfUnaryExpr(n, parent)
   463  	case *Union:
   464  		return c.copyOnRewriteRefOfUnion(n, parent)
   465  	case *UnlockTables:
   466  		return c.copyOnRewriteRefOfUnlockTables(n, parent)
   467  	case *Update:
   468  		return c.copyOnRewriteRefOfUpdate(n, parent)
   469  	case *UpdateExpr:
   470  		return c.copyOnRewriteRefOfUpdateExpr(n, parent)
   471  	case UpdateExprs:
   472  		return c.copyOnRewriteUpdateExprs(n, parent)
   473  	case *UpdateXMLExpr:
   474  		return c.copyOnRewriteRefOfUpdateXMLExpr(n, parent)
   475  	case *Use:
   476  		return c.copyOnRewriteRefOfUse(n, parent)
   477  	case *VExplainStmt:
   478  		return c.copyOnRewriteRefOfVExplainStmt(n, parent)
   479  	case *VStream:
   480  		return c.copyOnRewriteRefOfVStream(n, parent)
   481  	case ValTuple:
   482  		return c.copyOnRewriteValTuple(n, parent)
   483  	case *Validation:
   484  		return c.copyOnRewriteRefOfValidation(n, parent)
   485  	case Values:
   486  		return c.copyOnRewriteValues(n, parent)
   487  	case *ValuesFuncExpr:
   488  		return c.copyOnRewriteRefOfValuesFuncExpr(n, parent)
   489  	case *VarPop:
   490  		return c.copyOnRewriteRefOfVarPop(n, parent)
   491  	case *VarSamp:
   492  		return c.copyOnRewriteRefOfVarSamp(n, parent)
   493  	case *Variable:
   494  		return c.copyOnRewriteRefOfVariable(n, parent)
   495  	case *Variance:
   496  		return c.copyOnRewriteRefOfVariance(n, parent)
   497  	case VindexParam:
   498  		return c.copyOnRewriteVindexParam(n, parent)
   499  	case *VindexSpec:
   500  		return c.copyOnRewriteRefOfVindexSpec(n, parent)
   501  	case *WeightStringFuncExpr:
   502  		return c.copyOnRewriteRefOfWeightStringFuncExpr(n, parent)
   503  	case *When:
   504  		return c.copyOnRewriteRefOfWhen(n, parent)
   505  	case *Where:
   506  		return c.copyOnRewriteRefOfWhere(n, parent)
   507  	case *WindowDefinition:
   508  		return c.copyOnRewriteRefOfWindowDefinition(n, parent)
   509  	case WindowDefinitions:
   510  		return c.copyOnRewriteWindowDefinitions(n, parent)
   511  	case *WindowSpecification:
   512  		return c.copyOnRewriteRefOfWindowSpecification(n, parent)
   513  	case *With:
   514  		return c.copyOnRewriteRefOfWith(n, parent)
   515  	case *XorExpr:
   516  		return c.copyOnRewriteRefOfXorExpr(n, parent)
   517  	default:
   518  		// this should never happen
   519  		return nil, false
   520  	}
   521  }
   522  func (c *cow) copyOnRewriteRefOfAddColumns(n *AddColumns, parent SQLNode) (out SQLNode, changed bool) {
   523  	if n == nil || c.cursor.stop {
   524  		return n, false
   525  	}
   526  	out = n
   527  	if c.pre == nil || c.pre(n, parent) {
   528  		var changedColumns bool
   529  		_Columns := make([]*ColumnDefinition, len(n.Columns))
   530  		for x, el := range n.Columns {
   531  			this, changed := c.copyOnRewriteRefOfColumnDefinition(el, n)
   532  			_Columns[x] = this.(*ColumnDefinition)
   533  			if changed {
   534  				changedColumns = true
   535  			}
   536  		}
   537  		_After, changedAfter := c.copyOnRewriteRefOfColName(n.After, n)
   538  		if changedColumns || changedAfter {
   539  			res := *n
   540  			res.Columns = _Columns
   541  			res.After, _ = _After.(*ColName)
   542  			out = &res
   543  			if c.cloned != nil {
   544  				c.cloned(n, out)
   545  			}
   546  			changed = true
   547  		}
   548  	}
   549  	if c.post != nil {
   550  		out, changed = c.postVisit(out, parent, changed)
   551  	}
   552  	return
   553  }
   554  func (c *cow) copyOnRewriteRefOfAddConstraintDefinition(n *AddConstraintDefinition, parent SQLNode) (out SQLNode, changed bool) {
   555  	if n == nil || c.cursor.stop {
   556  		return n, false
   557  	}
   558  	out = n
   559  	if c.pre == nil || c.pre(n, parent) {
   560  		_ConstraintDefinition, changedConstraintDefinition := c.copyOnRewriteRefOfConstraintDefinition(n.ConstraintDefinition, n)
   561  		if changedConstraintDefinition {
   562  			res := *n
   563  			res.ConstraintDefinition, _ = _ConstraintDefinition.(*ConstraintDefinition)
   564  			out = &res
   565  			if c.cloned != nil {
   566  				c.cloned(n, out)
   567  			}
   568  			changed = true
   569  		}
   570  	}
   571  	if c.post != nil {
   572  		out, changed = c.postVisit(out, parent, changed)
   573  	}
   574  	return
   575  }
   576  func (c *cow) copyOnRewriteRefOfAddIndexDefinition(n *AddIndexDefinition, parent SQLNode) (out SQLNode, changed bool) {
   577  	if n == nil || c.cursor.stop {
   578  		return n, false
   579  	}
   580  	out = n
   581  	if c.pre == nil || c.pre(n, parent) {
   582  		_IndexDefinition, changedIndexDefinition := c.copyOnRewriteRefOfIndexDefinition(n.IndexDefinition, n)
   583  		if changedIndexDefinition {
   584  			res := *n
   585  			res.IndexDefinition, _ = _IndexDefinition.(*IndexDefinition)
   586  			out = &res
   587  			if c.cloned != nil {
   588  				c.cloned(n, out)
   589  			}
   590  			changed = true
   591  		}
   592  	}
   593  	if c.post != nil {
   594  		out, changed = c.postVisit(out, parent, changed)
   595  	}
   596  	return
   597  }
   598  func (c *cow) copyOnRewriteRefOfAliasedExpr(n *AliasedExpr, parent SQLNode) (out SQLNode, changed bool) {
   599  	if n == nil || c.cursor.stop {
   600  		return n, false
   601  	}
   602  	out = n
   603  	if c.pre == nil || c.pre(n, parent) {
   604  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
   605  		_As, changedAs := c.copyOnRewriteIdentifierCI(n.As, n)
   606  		if changedExpr || changedAs {
   607  			res := *n
   608  			res.Expr, _ = _Expr.(Expr)
   609  			res.As, _ = _As.(IdentifierCI)
   610  			out = &res
   611  			if c.cloned != nil {
   612  				c.cloned(n, out)
   613  			}
   614  			changed = true
   615  		}
   616  	}
   617  	if c.post != nil {
   618  		out, changed = c.postVisit(out, parent, changed)
   619  	}
   620  	return
   621  }
   622  func (c *cow) copyOnRewriteRefOfAliasedTableExpr(n *AliasedTableExpr, parent SQLNode) (out SQLNode, changed bool) {
   623  	if n == nil || c.cursor.stop {
   624  		return n, false
   625  	}
   626  	out = n
   627  	if c.pre == nil || c.pre(n, parent) {
   628  		_Expr, changedExpr := c.copyOnRewriteSimpleTableExpr(n.Expr, n)
   629  		_Partitions, changedPartitions := c.copyOnRewritePartitions(n.Partitions, n)
   630  		_As, changedAs := c.copyOnRewriteIdentifierCS(n.As, n)
   631  		_Hints, changedHints := c.copyOnRewriteIndexHints(n.Hints, n)
   632  		_Columns, changedColumns := c.copyOnRewriteColumns(n.Columns, n)
   633  		if changedExpr || changedPartitions || changedAs || changedHints || changedColumns {
   634  			res := *n
   635  			res.Expr, _ = _Expr.(SimpleTableExpr)
   636  			res.Partitions, _ = _Partitions.(Partitions)
   637  			res.As, _ = _As.(IdentifierCS)
   638  			res.Hints, _ = _Hints.(IndexHints)
   639  			res.Columns, _ = _Columns.(Columns)
   640  			out = &res
   641  			if c.cloned != nil {
   642  				c.cloned(n, out)
   643  			}
   644  			changed = true
   645  		}
   646  	}
   647  	if c.post != nil {
   648  		out, changed = c.postVisit(out, parent, changed)
   649  	}
   650  	return
   651  }
   652  func (c *cow) copyOnRewriteRefOfAlterCharset(n *AlterCharset, parent SQLNode) (out SQLNode, changed bool) {
   653  	if n == nil || c.cursor.stop {
   654  		return n, false
   655  	}
   656  	out = n
   657  	if c.pre == nil || c.pre(n, parent) {
   658  	}
   659  	if c.post != nil {
   660  		out, changed = c.postVisit(out, parent, changed)
   661  	}
   662  	return
   663  }
   664  func (c *cow) copyOnRewriteRefOfAlterCheck(n *AlterCheck, parent SQLNode) (out SQLNode, changed bool) {
   665  	if n == nil || c.cursor.stop {
   666  		return n, false
   667  	}
   668  	out = n
   669  	if c.pre == nil || c.pre(n, parent) {
   670  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
   671  		if changedName {
   672  			res := *n
   673  			res.Name, _ = _Name.(IdentifierCI)
   674  			out = &res
   675  			if c.cloned != nil {
   676  				c.cloned(n, out)
   677  			}
   678  			changed = true
   679  		}
   680  	}
   681  	if c.post != nil {
   682  		out, changed = c.postVisit(out, parent, changed)
   683  	}
   684  	return
   685  }
   686  func (c *cow) copyOnRewriteRefOfAlterColumn(n *AlterColumn, parent SQLNode) (out SQLNode, changed bool) {
   687  	if n == nil || c.cursor.stop {
   688  		return n, false
   689  	}
   690  	out = n
   691  	if c.pre == nil || c.pre(n, parent) {
   692  		_Column, changedColumn := c.copyOnRewriteRefOfColName(n.Column, n)
   693  		_DefaultVal, changedDefaultVal := c.copyOnRewriteExpr(n.DefaultVal, n)
   694  		if changedColumn || changedDefaultVal {
   695  			res := *n
   696  			res.Column, _ = _Column.(*ColName)
   697  			res.DefaultVal, _ = _DefaultVal.(Expr)
   698  			out = &res
   699  			if c.cloned != nil {
   700  				c.cloned(n, out)
   701  			}
   702  			changed = true
   703  		}
   704  	}
   705  	if c.post != nil {
   706  		out, changed = c.postVisit(out, parent, changed)
   707  	}
   708  	return
   709  }
   710  func (c *cow) copyOnRewriteRefOfAlterDatabase(n *AlterDatabase, parent SQLNode) (out SQLNode, changed bool) {
   711  	if n == nil || c.cursor.stop {
   712  		return n, false
   713  	}
   714  	out = n
   715  	if c.pre == nil || c.pre(n, parent) {
   716  		_DBName, changedDBName := c.copyOnRewriteIdentifierCS(n.DBName, n)
   717  		if changedDBName {
   718  			res := *n
   719  			res.DBName, _ = _DBName.(IdentifierCS)
   720  			out = &res
   721  			if c.cloned != nil {
   722  				c.cloned(n, out)
   723  			}
   724  			changed = true
   725  		}
   726  	}
   727  	if c.post != nil {
   728  		out, changed = c.postVisit(out, parent, changed)
   729  	}
   730  	return
   731  }
   732  func (c *cow) copyOnRewriteRefOfAlterIndex(n *AlterIndex, parent SQLNode) (out SQLNode, changed bool) {
   733  	if n == nil || c.cursor.stop {
   734  		return n, false
   735  	}
   736  	out = n
   737  	if c.pre == nil || c.pre(n, parent) {
   738  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
   739  		if changedName {
   740  			res := *n
   741  			res.Name, _ = _Name.(IdentifierCI)
   742  			out = &res
   743  			if c.cloned != nil {
   744  				c.cloned(n, out)
   745  			}
   746  			changed = true
   747  		}
   748  	}
   749  	if c.post != nil {
   750  		out, changed = c.postVisit(out, parent, changed)
   751  	}
   752  	return
   753  }
   754  func (c *cow) copyOnRewriteRefOfAlterMigration(n *AlterMigration, parent SQLNode) (out SQLNode, changed bool) {
   755  	if n == nil || c.cursor.stop {
   756  		return n, false
   757  	}
   758  	out = n
   759  	if c.pre == nil || c.pre(n, parent) {
   760  		_Ratio, changedRatio := c.copyOnRewriteRefOfLiteral(n.Ratio, n)
   761  		if changedRatio {
   762  			res := *n
   763  			res.Ratio, _ = _Ratio.(*Literal)
   764  			out = &res
   765  			if c.cloned != nil {
   766  				c.cloned(n, out)
   767  			}
   768  			changed = true
   769  		}
   770  	}
   771  	if c.post != nil {
   772  		out, changed = c.postVisit(out, parent, changed)
   773  	}
   774  	return
   775  }
   776  func (c *cow) copyOnRewriteRefOfAlterTable(n *AlterTable, parent SQLNode) (out SQLNode, changed bool) {
   777  	if n == nil || c.cursor.stop {
   778  		return n, false
   779  	}
   780  	out = n
   781  	if c.pre == nil || c.pre(n, parent) {
   782  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
   783  		var changedAlterOptions bool
   784  		_AlterOptions := make([]AlterOption, len(n.AlterOptions))
   785  		for x, el := range n.AlterOptions {
   786  			this, changed := c.copyOnRewriteAlterOption(el, n)
   787  			_AlterOptions[x] = this.(AlterOption)
   788  			if changed {
   789  				changedAlterOptions = true
   790  			}
   791  		}
   792  		_PartitionSpec, changedPartitionSpec := c.copyOnRewriteRefOfPartitionSpec(n.PartitionSpec, n)
   793  		_PartitionOption, changedPartitionOption := c.copyOnRewriteRefOfPartitionOption(n.PartitionOption, n)
   794  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
   795  		if changedTable || changedAlterOptions || changedPartitionSpec || changedPartitionOption || changedComments {
   796  			res := *n
   797  			res.Table, _ = _Table.(TableName)
   798  			res.AlterOptions = _AlterOptions
   799  			res.PartitionSpec, _ = _PartitionSpec.(*PartitionSpec)
   800  			res.PartitionOption, _ = _PartitionOption.(*PartitionOption)
   801  			res.Comments, _ = _Comments.(*ParsedComments)
   802  			out = &res
   803  			if c.cloned != nil {
   804  				c.cloned(n, out)
   805  			}
   806  			changed = true
   807  		}
   808  	}
   809  	if c.post != nil {
   810  		out, changed = c.postVisit(out, parent, changed)
   811  	}
   812  	return
   813  }
   814  func (c *cow) copyOnRewriteRefOfAlterView(n *AlterView, parent SQLNode) (out SQLNode, changed bool) {
   815  	if n == nil || c.cursor.stop {
   816  		return n, false
   817  	}
   818  	out = n
   819  	if c.pre == nil || c.pre(n, parent) {
   820  		_ViewName, changedViewName := c.copyOnRewriteTableName(n.ViewName, n)
   821  		_Definer, changedDefiner := c.copyOnRewriteRefOfDefiner(n.Definer, n)
   822  		_Columns, changedColumns := c.copyOnRewriteColumns(n.Columns, n)
   823  		_Select, changedSelect := c.copyOnRewriteSelectStatement(n.Select, n)
   824  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
   825  		if changedViewName || changedDefiner || changedColumns || changedSelect || changedComments {
   826  			res := *n
   827  			res.ViewName, _ = _ViewName.(TableName)
   828  			res.Definer, _ = _Definer.(*Definer)
   829  			res.Columns, _ = _Columns.(Columns)
   830  			res.Select, _ = _Select.(SelectStatement)
   831  			res.Comments, _ = _Comments.(*ParsedComments)
   832  			out = &res
   833  			if c.cloned != nil {
   834  				c.cloned(n, out)
   835  			}
   836  			changed = true
   837  		}
   838  	}
   839  	if c.post != nil {
   840  		out, changed = c.postVisit(out, parent, changed)
   841  	}
   842  	return
   843  }
   844  func (c *cow) copyOnRewriteRefOfAlterVschema(n *AlterVschema, parent SQLNode) (out SQLNode, changed bool) {
   845  	if n == nil || c.cursor.stop {
   846  		return n, false
   847  	}
   848  	out = n
   849  	if c.pre == nil || c.pre(n, parent) {
   850  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
   851  		_VindexSpec, changedVindexSpec := c.copyOnRewriteRefOfVindexSpec(n.VindexSpec, n)
   852  		var changedVindexCols bool
   853  		_VindexCols := make([]IdentifierCI, len(n.VindexCols))
   854  		for x, el := range n.VindexCols {
   855  			this, changed := c.copyOnRewriteIdentifierCI(el, n)
   856  			_VindexCols[x] = this.(IdentifierCI)
   857  			if changed {
   858  				changedVindexCols = true
   859  			}
   860  		}
   861  		_AutoIncSpec, changedAutoIncSpec := c.copyOnRewriteRefOfAutoIncSpec(n.AutoIncSpec, n)
   862  		if changedTable || changedVindexSpec || changedVindexCols || changedAutoIncSpec {
   863  			res := *n
   864  			res.Table, _ = _Table.(TableName)
   865  			res.VindexSpec, _ = _VindexSpec.(*VindexSpec)
   866  			res.VindexCols = _VindexCols
   867  			res.AutoIncSpec, _ = _AutoIncSpec.(*AutoIncSpec)
   868  			out = &res
   869  			if c.cloned != nil {
   870  				c.cloned(n, out)
   871  			}
   872  			changed = true
   873  		}
   874  	}
   875  	if c.post != nil {
   876  		out, changed = c.postVisit(out, parent, changed)
   877  	}
   878  	return
   879  }
   880  func (c *cow) copyOnRewriteRefOfAndExpr(n *AndExpr, parent SQLNode) (out SQLNode, changed bool) {
   881  	if n == nil || c.cursor.stop {
   882  		return n, false
   883  	}
   884  	out = n
   885  	if c.pre == nil || c.pre(n, parent) {
   886  		_Left, changedLeft := c.copyOnRewriteExpr(n.Left, n)
   887  		_Right, changedRight := c.copyOnRewriteExpr(n.Right, n)
   888  		if changedLeft || changedRight {
   889  			res := *n
   890  			res.Left, _ = _Left.(Expr)
   891  			res.Right, _ = _Right.(Expr)
   892  			out = &res
   893  			if c.cloned != nil {
   894  				c.cloned(n, out)
   895  			}
   896  			changed = true
   897  		}
   898  	}
   899  	if c.post != nil {
   900  		out, changed = c.postVisit(out, parent, changed)
   901  	}
   902  	return
   903  }
   904  func (c *cow) copyOnRewriteRefOfArgumentLessWindowExpr(n *ArgumentLessWindowExpr, parent SQLNode) (out SQLNode, changed bool) {
   905  	if n == nil || c.cursor.stop {
   906  		return n, false
   907  	}
   908  	out = n
   909  	if c.pre == nil || c.pre(n, parent) {
   910  		_OverClause, changedOverClause := c.copyOnRewriteRefOfOverClause(n.OverClause, n)
   911  		if changedOverClause {
   912  			res := *n
   913  			res.OverClause, _ = _OverClause.(*OverClause)
   914  			out = &res
   915  			if c.cloned != nil {
   916  				c.cloned(n, out)
   917  			}
   918  			changed = true
   919  		}
   920  	}
   921  	if c.post != nil {
   922  		out, changed = c.postVisit(out, parent, changed)
   923  	}
   924  	return
   925  }
   926  func (c *cow) copyOnRewriteRefOfAutoIncSpec(n *AutoIncSpec, parent SQLNode) (out SQLNode, changed bool) {
   927  	if n == nil || c.cursor.stop {
   928  		return n, false
   929  	}
   930  	out = n
   931  	if c.pre == nil || c.pre(n, parent) {
   932  		_Column, changedColumn := c.copyOnRewriteIdentifierCI(n.Column, n)
   933  		_Sequence, changedSequence := c.copyOnRewriteTableName(n.Sequence, n)
   934  		if changedColumn || changedSequence {
   935  			res := *n
   936  			res.Column, _ = _Column.(IdentifierCI)
   937  			res.Sequence, _ = _Sequence.(TableName)
   938  			out = &res
   939  			if c.cloned != nil {
   940  				c.cloned(n, out)
   941  			}
   942  			changed = true
   943  		}
   944  	}
   945  	if c.post != nil {
   946  		out, changed = c.postVisit(out, parent, changed)
   947  	}
   948  	return
   949  }
   950  func (c *cow) copyOnRewriteRefOfAvg(n *Avg, parent SQLNode) (out SQLNode, changed bool) {
   951  	if n == nil || c.cursor.stop {
   952  		return n, false
   953  	}
   954  	out = n
   955  	if c.pre == nil || c.pre(n, parent) {
   956  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
   957  		if changedArg {
   958  			res := *n
   959  			res.Arg, _ = _Arg.(Expr)
   960  			out = &res
   961  			if c.cloned != nil {
   962  				c.cloned(n, out)
   963  			}
   964  			changed = true
   965  		}
   966  	}
   967  	if c.post != nil {
   968  		out, changed = c.postVisit(out, parent, changed)
   969  	}
   970  	return
   971  }
   972  func (c *cow) copyOnRewriteRefOfBegin(n *Begin, parent SQLNode) (out SQLNode, changed bool) {
   973  	if n == nil || c.cursor.stop {
   974  		return n, false
   975  	}
   976  	out = n
   977  	if c.pre == nil || c.pre(n, parent) {
   978  	}
   979  	if c.post != nil {
   980  		out, changed = c.postVisit(out, parent, changed)
   981  	}
   982  	return
   983  }
   984  func (c *cow) copyOnRewriteRefOfBetweenExpr(n *BetweenExpr, parent SQLNode) (out SQLNode, changed bool) {
   985  	if n == nil || c.cursor.stop {
   986  		return n, false
   987  	}
   988  	out = n
   989  	if c.pre == nil || c.pre(n, parent) {
   990  		_Left, changedLeft := c.copyOnRewriteExpr(n.Left, n)
   991  		_From, changedFrom := c.copyOnRewriteExpr(n.From, n)
   992  		_To, changedTo := c.copyOnRewriteExpr(n.To, n)
   993  		if changedLeft || changedFrom || changedTo {
   994  			res := *n
   995  			res.Left, _ = _Left.(Expr)
   996  			res.From, _ = _From.(Expr)
   997  			res.To, _ = _To.(Expr)
   998  			out = &res
   999  			if c.cloned != nil {
  1000  				c.cloned(n, out)
  1001  			}
  1002  			changed = true
  1003  		}
  1004  	}
  1005  	if c.post != nil {
  1006  		out, changed = c.postVisit(out, parent, changed)
  1007  	}
  1008  	return
  1009  }
  1010  func (c *cow) copyOnRewriteRefOfBinaryExpr(n *BinaryExpr, parent SQLNode) (out SQLNode, changed bool) {
  1011  	if n == nil || c.cursor.stop {
  1012  		return n, false
  1013  	}
  1014  	out = n
  1015  	if c.pre == nil || c.pre(n, parent) {
  1016  		_Left, changedLeft := c.copyOnRewriteExpr(n.Left, n)
  1017  		_Right, changedRight := c.copyOnRewriteExpr(n.Right, n)
  1018  		if changedLeft || changedRight {
  1019  			res := *n
  1020  			res.Left, _ = _Left.(Expr)
  1021  			res.Right, _ = _Right.(Expr)
  1022  			out = &res
  1023  			if c.cloned != nil {
  1024  				c.cloned(n, out)
  1025  			}
  1026  			changed = true
  1027  		}
  1028  	}
  1029  	if c.post != nil {
  1030  		out, changed = c.postVisit(out, parent, changed)
  1031  	}
  1032  	return
  1033  }
  1034  func (c *cow) copyOnRewriteRefOfBitAnd(n *BitAnd, parent SQLNode) (out SQLNode, changed bool) {
  1035  	if n == nil || c.cursor.stop {
  1036  		return n, false
  1037  	}
  1038  	out = n
  1039  	if c.pre == nil || c.pre(n, parent) {
  1040  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  1041  		if changedArg {
  1042  			res := *n
  1043  			res.Arg, _ = _Arg.(Expr)
  1044  			out = &res
  1045  			if c.cloned != nil {
  1046  				c.cloned(n, out)
  1047  			}
  1048  			changed = true
  1049  		}
  1050  	}
  1051  	if c.post != nil {
  1052  		out, changed = c.postVisit(out, parent, changed)
  1053  	}
  1054  	return
  1055  }
  1056  func (c *cow) copyOnRewriteRefOfBitOr(n *BitOr, parent SQLNode) (out SQLNode, changed bool) {
  1057  	if n == nil || c.cursor.stop {
  1058  		return n, false
  1059  	}
  1060  	out = n
  1061  	if c.pre == nil || c.pre(n, parent) {
  1062  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  1063  		if changedArg {
  1064  			res := *n
  1065  			res.Arg, _ = _Arg.(Expr)
  1066  			out = &res
  1067  			if c.cloned != nil {
  1068  				c.cloned(n, out)
  1069  			}
  1070  			changed = true
  1071  		}
  1072  	}
  1073  	if c.post != nil {
  1074  		out, changed = c.postVisit(out, parent, changed)
  1075  	}
  1076  	return
  1077  }
  1078  func (c *cow) copyOnRewriteRefOfBitXor(n *BitXor, parent SQLNode) (out SQLNode, changed bool) {
  1079  	if n == nil || c.cursor.stop {
  1080  		return n, false
  1081  	}
  1082  	out = n
  1083  	if c.pre == nil || c.pre(n, parent) {
  1084  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  1085  		if changedArg {
  1086  			res := *n
  1087  			res.Arg, _ = _Arg.(Expr)
  1088  			out = &res
  1089  			if c.cloned != nil {
  1090  				c.cloned(n, out)
  1091  			}
  1092  			changed = true
  1093  		}
  1094  	}
  1095  	if c.post != nil {
  1096  		out, changed = c.postVisit(out, parent, changed)
  1097  	}
  1098  	return
  1099  }
  1100  func (c *cow) copyOnRewriteRefOfCallProc(n *CallProc, parent SQLNode) (out SQLNode, changed bool) {
  1101  	if n == nil || c.cursor.stop {
  1102  		return n, false
  1103  	}
  1104  	out = n
  1105  	if c.pre == nil || c.pre(n, parent) {
  1106  		_Name, changedName := c.copyOnRewriteTableName(n.Name, n)
  1107  		_Params, changedParams := c.copyOnRewriteExprs(n.Params, n)
  1108  		if changedName || changedParams {
  1109  			res := *n
  1110  			res.Name, _ = _Name.(TableName)
  1111  			res.Params, _ = _Params.(Exprs)
  1112  			out = &res
  1113  			if c.cloned != nil {
  1114  				c.cloned(n, out)
  1115  			}
  1116  			changed = true
  1117  		}
  1118  	}
  1119  	if c.post != nil {
  1120  		out, changed = c.postVisit(out, parent, changed)
  1121  	}
  1122  	return
  1123  }
  1124  func (c *cow) copyOnRewriteRefOfCaseExpr(n *CaseExpr, parent SQLNode) (out SQLNode, changed bool) {
  1125  	if n == nil || c.cursor.stop {
  1126  		return n, false
  1127  	}
  1128  	out = n
  1129  	if c.pre == nil || c.pre(n, parent) {
  1130  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  1131  		var changedWhens bool
  1132  		_Whens := make([]*When, len(n.Whens))
  1133  		for x, el := range n.Whens {
  1134  			this, changed := c.copyOnRewriteRefOfWhen(el, n)
  1135  			_Whens[x] = this.(*When)
  1136  			if changed {
  1137  				changedWhens = true
  1138  			}
  1139  		}
  1140  		_Else, changedElse := c.copyOnRewriteExpr(n.Else, n)
  1141  		if changedExpr || changedWhens || changedElse {
  1142  			res := *n
  1143  			res.Expr, _ = _Expr.(Expr)
  1144  			res.Whens = _Whens
  1145  			res.Else, _ = _Else.(Expr)
  1146  			out = &res
  1147  			if c.cloned != nil {
  1148  				c.cloned(n, out)
  1149  			}
  1150  			changed = true
  1151  		}
  1152  	}
  1153  	if c.post != nil {
  1154  		out, changed = c.postVisit(out, parent, changed)
  1155  	}
  1156  	return
  1157  }
  1158  func (c *cow) copyOnRewriteRefOfCastExpr(n *CastExpr, parent SQLNode) (out SQLNode, changed bool) {
  1159  	if n == nil || c.cursor.stop {
  1160  		return n, false
  1161  	}
  1162  	out = n
  1163  	if c.pre == nil || c.pre(n, parent) {
  1164  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  1165  		_Type, changedType := c.copyOnRewriteRefOfConvertType(n.Type, n)
  1166  		if changedExpr || changedType {
  1167  			res := *n
  1168  			res.Expr, _ = _Expr.(Expr)
  1169  			res.Type, _ = _Type.(*ConvertType)
  1170  			out = &res
  1171  			if c.cloned != nil {
  1172  				c.cloned(n, out)
  1173  			}
  1174  			changed = true
  1175  		}
  1176  	}
  1177  	if c.post != nil {
  1178  		out, changed = c.postVisit(out, parent, changed)
  1179  	}
  1180  	return
  1181  }
  1182  func (c *cow) copyOnRewriteRefOfChangeColumn(n *ChangeColumn, parent SQLNode) (out SQLNode, changed bool) {
  1183  	if n == nil || c.cursor.stop {
  1184  		return n, false
  1185  	}
  1186  	out = n
  1187  	if c.pre == nil || c.pre(n, parent) {
  1188  		_OldColumn, changedOldColumn := c.copyOnRewriteRefOfColName(n.OldColumn, n)
  1189  		_NewColDefinition, changedNewColDefinition := c.copyOnRewriteRefOfColumnDefinition(n.NewColDefinition, n)
  1190  		_After, changedAfter := c.copyOnRewriteRefOfColName(n.After, n)
  1191  		if changedOldColumn || changedNewColDefinition || changedAfter {
  1192  			res := *n
  1193  			res.OldColumn, _ = _OldColumn.(*ColName)
  1194  			res.NewColDefinition, _ = _NewColDefinition.(*ColumnDefinition)
  1195  			res.After, _ = _After.(*ColName)
  1196  			out = &res
  1197  			if c.cloned != nil {
  1198  				c.cloned(n, out)
  1199  			}
  1200  			changed = true
  1201  		}
  1202  	}
  1203  	if c.post != nil {
  1204  		out, changed = c.postVisit(out, parent, changed)
  1205  	}
  1206  	return
  1207  }
  1208  func (c *cow) copyOnRewriteRefOfCharExpr(n *CharExpr, parent SQLNode) (out SQLNode, changed bool) {
  1209  	if n == nil || c.cursor.stop {
  1210  		return n, false
  1211  	}
  1212  	out = n
  1213  	if c.pre == nil || c.pre(n, parent) {
  1214  		_Exprs, changedExprs := c.copyOnRewriteExprs(n.Exprs, n)
  1215  		if changedExprs {
  1216  			res := *n
  1217  			res.Exprs, _ = _Exprs.(Exprs)
  1218  			out = &res
  1219  			if c.cloned != nil {
  1220  				c.cloned(n, out)
  1221  			}
  1222  			changed = true
  1223  		}
  1224  	}
  1225  	if c.post != nil {
  1226  		out, changed = c.postVisit(out, parent, changed)
  1227  	}
  1228  	return
  1229  }
  1230  func (c *cow) copyOnRewriteRefOfCheckConstraintDefinition(n *CheckConstraintDefinition, parent SQLNode) (out SQLNode, changed bool) {
  1231  	if n == nil || c.cursor.stop {
  1232  		return n, false
  1233  	}
  1234  	out = n
  1235  	if c.pre == nil || c.pre(n, parent) {
  1236  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  1237  		if changedExpr {
  1238  			res := *n
  1239  			res.Expr, _ = _Expr.(Expr)
  1240  			out = &res
  1241  			if c.cloned != nil {
  1242  				c.cloned(n, out)
  1243  			}
  1244  			changed = true
  1245  		}
  1246  	}
  1247  	if c.post != nil {
  1248  		out, changed = c.postVisit(out, parent, changed)
  1249  	}
  1250  	return
  1251  }
  1252  func (c *cow) copyOnRewriteRefOfColName(n *ColName, parent SQLNode) (out SQLNode, changed bool) {
  1253  	if n == nil || c.cursor.stop {
  1254  		return n, false
  1255  	}
  1256  	out = n
  1257  	if c.pre == nil || c.pre(n, parent) {
  1258  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  1259  		_Qualifier, changedQualifier := c.copyOnRewriteTableName(n.Qualifier, n)
  1260  		if changedName || changedQualifier {
  1261  			res := *n
  1262  			res.Name, _ = _Name.(IdentifierCI)
  1263  			res.Qualifier, _ = _Qualifier.(TableName)
  1264  			out = &res
  1265  			if c.cloned != nil {
  1266  				c.cloned(n, out)
  1267  			}
  1268  			changed = true
  1269  		}
  1270  	}
  1271  	if c.post != nil {
  1272  		out, changed = c.postVisit(out, parent, changed)
  1273  	}
  1274  	return
  1275  }
  1276  func (c *cow) copyOnRewriteRefOfCollateExpr(n *CollateExpr, parent SQLNode) (out SQLNode, changed bool) {
  1277  	if n == nil || c.cursor.stop {
  1278  		return n, false
  1279  	}
  1280  	out = n
  1281  	if c.pre == nil || c.pre(n, parent) {
  1282  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  1283  		if changedExpr {
  1284  			res := *n
  1285  			res.Expr, _ = _Expr.(Expr)
  1286  			out = &res
  1287  			if c.cloned != nil {
  1288  				c.cloned(n, out)
  1289  			}
  1290  			changed = true
  1291  		}
  1292  	}
  1293  	if c.post != nil {
  1294  		out, changed = c.postVisit(out, parent, changed)
  1295  	}
  1296  	return
  1297  }
  1298  func (c *cow) copyOnRewriteRefOfColumnDefinition(n *ColumnDefinition, parent SQLNode) (out SQLNode, changed bool) {
  1299  	if n == nil || c.cursor.stop {
  1300  		return n, false
  1301  	}
  1302  	out = n
  1303  	if c.pre == nil || c.pre(n, parent) {
  1304  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  1305  		_Type, changedType := c.copyOnRewriteRefOfColumnType(n.Type, n)
  1306  		if changedName || changedType {
  1307  			res := *n
  1308  			res.Name, _ = _Name.(IdentifierCI)
  1309  			res.Type, _ = _Type.(*ColumnType)
  1310  			out = &res
  1311  			if c.cloned != nil {
  1312  				c.cloned(n, out)
  1313  			}
  1314  			changed = true
  1315  		}
  1316  	}
  1317  	if c.post != nil {
  1318  		out, changed = c.postVisit(out, parent, changed)
  1319  	}
  1320  	return
  1321  }
  1322  func (c *cow) copyOnRewriteRefOfColumnType(n *ColumnType, parent SQLNode) (out SQLNode, changed bool) {
  1323  	if n == nil || c.cursor.stop {
  1324  		return n, false
  1325  	}
  1326  	out = n
  1327  	if c.pre == nil || c.pre(n, parent) {
  1328  		_Length, changedLength := c.copyOnRewriteRefOfLiteral(n.Length, n)
  1329  		_Scale, changedScale := c.copyOnRewriteRefOfLiteral(n.Scale, n)
  1330  		if changedLength || changedScale {
  1331  			res := *n
  1332  			res.Length, _ = _Length.(*Literal)
  1333  			res.Scale, _ = _Scale.(*Literal)
  1334  			out = &res
  1335  			if c.cloned != nil {
  1336  				c.cloned(n, out)
  1337  			}
  1338  			changed = true
  1339  		}
  1340  	}
  1341  	if c.post != nil {
  1342  		out, changed = c.postVisit(out, parent, changed)
  1343  	}
  1344  	return
  1345  }
  1346  func (c *cow) copyOnRewriteColumns(n Columns, parent SQLNode) (out SQLNode, changed bool) {
  1347  	if n == nil || c.cursor.stop {
  1348  		return n, false
  1349  	}
  1350  	out = n
  1351  	if c.pre == nil || c.pre(n, parent) {
  1352  		res := make(Columns, len(n))
  1353  		for x, el := range n {
  1354  			this, change := c.copyOnRewriteIdentifierCI(el, n)
  1355  			res[x] = this.(IdentifierCI)
  1356  			if change {
  1357  				changed = true
  1358  			}
  1359  		}
  1360  		if changed {
  1361  			out = res
  1362  		}
  1363  	}
  1364  	if c.post != nil {
  1365  		out, changed = c.postVisit(out, parent, changed)
  1366  	}
  1367  	return
  1368  }
  1369  func (c *cow) copyOnRewriteRefOfCommentOnly(n *CommentOnly, parent SQLNode) (out SQLNode, changed bool) {
  1370  	if n == nil || c.cursor.stop {
  1371  		return n, false
  1372  	}
  1373  	out = n
  1374  	if c.pre == nil || c.pre(n, parent) {
  1375  	}
  1376  	if c.post != nil {
  1377  		out, changed = c.postVisit(out, parent, changed)
  1378  	}
  1379  	return
  1380  }
  1381  func (c *cow) copyOnRewriteRefOfCommit(n *Commit, parent SQLNode) (out SQLNode, changed bool) {
  1382  	if n == nil || c.cursor.stop {
  1383  		return n, false
  1384  	}
  1385  	out = n
  1386  	if c.pre == nil || c.pre(n, parent) {
  1387  	}
  1388  	if c.post != nil {
  1389  		out, changed = c.postVisit(out, parent, changed)
  1390  	}
  1391  	return
  1392  }
  1393  func (c *cow) copyOnRewriteRefOfCommonTableExpr(n *CommonTableExpr, parent SQLNode) (out SQLNode, changed bool) {
  1394  	if n == nil || c.cursor.stop {
  1395  		return n, false
  1396  	}
  1397  	out = n
  1398  	if c.pre == nil || c.pre(n, parent) {
  1399  		_ID, changedID := c.copyOnRewriteIdentifierCS(n.ID, n)
  1400  		_Columns, changedColumns := c.copyOnRewriteColumns(n.Columns, n)
  1401  		_Subquery, changedSubquery := c.copyOnRewriteRefOfSubquery(n.Subquery, n)
  1402  		if changedID || changedColumns || changedSubquery {
  1403  			res := *n
  1404  			res.ID, _ = _ID.(IdentifierCS)
  1405  			res.Columns, _ = _Columns.(Columns)
  1406  			res.Subquery, _ = _Subquery.(*Subquery)
  1407  			out = &res
  1408  			if c.cloned != nil {
  1409  				c.cloned(n, out)
  1410  			}
  1411  			changed = true
  1412  		}
  1413  	}
  1414  	if c.post != nil {
  1415  		out, changed = c.postVisit(out, parent, changed)
  1416  	}
  1417  	return
  1418  }
  1419  func (c *cow) copyOnRewriteRefOfComparisonExpr(n *ComparisonExpr, parent SQLNode) (out SQLNode, changed bool) {
  1420  	if n == nil || c.cursor.stop {
  1421  		return n, false
  1422  	}
  1423  	out = n
  1424  	if c.pre == nil || c.pre(n, parent) {
  1425  		_Left, changedLeft := c.copyOnRewriteExpr(n.Left, n)
  1426  		_Right, changedRight := c.copyOnRewriteExpr(n.Right, n)
  1427  		_Escape, changedEscape := c.copyOnRewriteExpr(n.Escape, n)
  1428  		if changedLeft || changedRight || changedEscape {
  1429  			res := *n
  1430  			res.Left, _ = _Left.(Expr)
  1431  			res.Right, _ = _Right.(Expr)
  1432  			res.Escape, _ = _Escape.(Expr)
  1433  			out = &res
  1434  			if c.cloned != nil {
  1435  				c.cloned(n, out)
  1436  			}
  1437  			changed = true
  1438  		}
  1439  	}
  1440  	if c.post != nil {
  1441  		out, changed = c.postVisit(out, parent, changed)
  1442  	}
  1443  	return
  1444  }
  1445  func (c *cow) copyOnRewriteRefOfConstraintDefinition(n *ConstraintDefinition, parent SQLNode) (out SQLNode, changed bool) {
  1446  	if n == nil || c.cursor.stop {
  1447  		return n, false
  1448  	}
  1449  	out = n
  1450  	if c.pre == nil || c.pre(n, parent) {
  1451  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  1452  		_Details, changedDetails := c.copyOnRewriteConstraintInfo(n.Details, n)
  1453  		if changedName || changedDetails {
  1454  			res := *n
  1455  			res.Name, _ = _Name.(IdentifierCI)
  1456  			res.Details, _ = _Details.(ConstraintInfo)
  1457  			out = &res
  1458  			if c.cloned != nil {
  1459  				c.cloned(n, out)
  1460  			}
  1461  			changed = true
  1462  		}
  1463  	}
  1464  	if c.post != nil {
  1465  		out, changed = c.postVisit(out, parent, changed)
  1466  	}
  1467  	return
  1468  }
  1469  func (c *cow) copyOnRewriteRefOfConvertExpr(n *ConvertExpr, parent SQLNode) (out SQLNode, changed bool) {
  1470  	if n == nil || c.cursor.stop {
  1471  		return n, false
  1472  	}
  1473  	out = n
  1474  	if c.pre == nil || c.pre(n, parent) {
  1475  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  1476  		_Type, changedType := c.copyOnRewriteRefOfConvertType(n.Type, n)
  1477  		if changedExpr || changedType {
  1478  			res := *n
  1479  			res.Expr, _ = _Expr.(Expr)
  1480  			res.Type, _ = _Type.(*ConvertType)
  1481  			out = &res
  1482  			if c.cloned != nil {
  1483  				c.cloned(n, out)
  1484  			}
  1485  			changed = true
  1486  		}
  1487  	}
  1488  	if c.post != nil {
  1489  		out, changed = c.postVisit(out, parent, changed)
  1490  	}
  1491  	return
  1492  }
  1493  func (c *cow) copyOnRewriteRefOfConvertType(n *ConvertType, parent SQLNode) (out SQLNode, changed bool) {
  1494  	if n == nil || c.cursor.stop {
  1495  		return n, false
  1496  	}
  1497  	out = n
  1498  	if c.pre == nil || c.pre(n, parent) {
  1499  		_Length, changedLength := c.copyOnRewriteRefOfLiteral(n.Length, n)
  1500  		_Scale, changedScale := c.copyOnRewriteRefOfLiteral(n.Scale, n)
  1501  		if changedLength || changedScale {
  1502  			res := *n
  1503  			res.Length, _ = _Length.(*Literal)
  1504  			res.Scale, _ = _Scale.(*Literal)
  1505  			out = &res
  1506  			if c.cloned != nil {
  1507  				c.cloned(n, out)
  1508  			}
  1509  			changed = true
  1510  		}
  1511  	}
  1512  	if c.post != nil {
  1513  		out, changed = c.postVisit(out, parent, changed)
  1514  	}
  1515  	return
  1516  }
  1517  func (c *cow) copyOnRewriteRefOfConvertUsingExpr(n *ConvertUsingExpr, parent SQLNode) (out SQLNode, changed bool) {
  1518  	if n == nil || c.cursor.stop {
  1519  		return n, false
  1520  	}
  1521  	out = n
  1522  	if c.pre == nil || c.pre(n, parent) {
  1523  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  1524  		if changedExpr {
  1525  			res := *n
  1526  			res.Expr, _ = _Expr.(Expr)
  1527  			out = &res
  1528  			if c.cloned != nil {
  1529  				c.cloned(n, out)
  1530  			}
  1531  			changed = true
  1532  		}
  1533  	}
  1534  	if c.post != nil {
  1535  		out, changed = c.postVisit(out, parent, changed)
  1536  	}
  1537  	return
  1538  }
  1539  func (c *cow) copyOnRewriteRefOfCount(n *Count, parent SQLNode) (out SQLNode, changed bool) {
  1540  	if n == nil || c.cursor.stop {
  1541  		return n, false
  1542  	}
  1543  	out = n
  1544  	if c.pre == nil || c.pre(n, parent) {
  1545  		_Args, changedArgs := c.copyOnRewriteExprs(n.Args, n)
  1546  		if changedArgs {
  1547  			res := *n
  1548  			res.Args, _ = _Args.(Exprs)
  1549  			out = &res
  1550  			if c.cloned != nil {
  1551  				c.cloned(n, out)
  1552  			}
  1553  			changed = true
  1554  		}
  1555  	}
  1556  	if c.post != nil {
  1557  		out, changed = c.postVisit(out, parent, changed)
  1558  	}
  1559  	return
  1560  }
  1561  func (c *cow) copyOnRewriteRefOfCountStar(n *CountStar, parent SQLNode) (out SQLNode, changed bool) {
  1562  	if n == nil || c.cursor.stop {
  1563  		return n, false
  1564  	}
  1565  	out = n
  1566  	if c.pre == nil || c.pre(n, parent) {
  1567  	}
  1568  	if c.post != nil {
  1569  		out, changed = c.postVisit(out, parent, changed)
  1570  	}
  1571  	return
  1572  }
  1573  func (c *cow) copyOnRewriteRefOfCreateDatabase(n *CreateDatabase, parent SQLNode) (out SQLNode, changed bool) {
  1574  	if n == nil || c.cursor.stop {
  1575  		return n, false
  1576  	}
  1577  	out = n
  1578  	if c.pre == nil || c.pre(n, parent) {
  1579  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1580  		_DBName, changedDBName := c.copyOnRewriteIdentifierCS(n.DBName, n)
  1581  		if changedComments || changedDBName {
  1582  			res := *n
  1583  			res.Comments, _ = _Comments.(*ParsedComments)
  1584  			res.DBName, _ = _DBName.(IdentifierCS)
  1585  			out = &res
  1586  			if c.cloned != nil {
  1587  				c.cloned(n, out)
  1588  			}
  1589  			changed = true
  1590  		}
  1591  	}
  1592  	if c.post != nil {
  1593  		out, changed = c.postVisit(out, parent, changed)
  1594  	}
  1595  	return
  1596  }
  1597  func (c *cow) copyOnRewriteRefOfCreateTable(n *CreateTable, parent SQLNode) (out SQLNode, changed bool) {
  1598  	if n == nil || c.cursor.stop {
  1599  		return n, false
  1600  	}
  1601  	out = n
  1602  	if c.pre == nil || c.pre(n, parent) {
  1603  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
  1604  		_TableSpec, changedTableSpec := c.copyOnRewriteRefOfTableSpec(n.TableSpec, n)
  1605  		_OptLike, changedOptLike := c.copyOnRewriteRefOfOptLike(n.OptLike, n)
  1606  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1607  		if changedTable || changedTableSpec || changedOptLike || changedComments {
  1608  			res := *n
  1609  			res.Table, _ = _Table.(TableName)
  1610  			res.TableSpec, _ = _TableSpec.(*TableSpec)
  1611  			res.OptLike, _ = _OptLike.(*OptLike)
  1612  			res.Comments, _ = _Comments.(*ParsedComments)
  1613  			out = &res
  1614  			if c.cloned != nil {
  1615  				c.cloned(n, out)
  1616  			}
  1617  			changed = true
  1618  		}
  1619  	}
  1620  	if c.post != nil {
  1621  		out, changed = c.postVisit(out, parent, changed)
  1622  	}
  1623  	return
  1624  }
  1625  func (c *cow) copyOnRewriteRefOfCreateView(n *CreateView, parent SQLNode) (out SQLNode, changed bool) {
  1626  	if n == nil || c.cursor.stop {
  1627  		return n, false
  1628  	}
  1629  	out = n
  1630  	if c.pre == nil || c.pre(n, parent) {
  1631  		_ViewName, changedViewName := c.copyOnRewriteTableName(n.ViewName, n)
  1632  		_Definer, changedDefiner := c.copyOnRewriteRefOfDefiner(n.Definer, n)
  1633  		_Columns, changedColumns := c.copyOnRewriteColumns(n.Columns, n)
  1634  		_Select, changedSelect := c.copyOnRewriteSelectStatement(n.Select, n)
  1635  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1636  		if changedViewName || changedDefiner || changedColumns || changedSelect || changedComments {
  1637  			res := *n
  1638  			res.ViewName, _ = _ViewName.(TableName)
  1639  			res.Definer, _ = _Definer.(*Definer)
  1640  			res.Columns, _ = _Columns.(Columns)
  1641  			res.Select, _ = _Select.(SelectStatement)
  1642  			res.Comments, _ = _Comments.(*ParsedComments)
  1643  			out = &res
  1644  			if c.cloned != nil {
  1645  				c.cloned(n, out)
  1646  			}
  1647  			changed = true
  1648  		}
  1649  	}
  1650  	if c.post != nil {
  1651  		out, changed = c.postVisit(out, parent, changed)
  1652  	}
  1653  	return
  1654  }
  1655  func (c *cow) copyOnRewriteRefOfCurTimeFuncExpr(n *CurTimeFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  1656  	if n == nil || c.cursor.stop {
  1657  		return n, false
  1658  	}
  1659  	out = n
  1660  	if c.pre == nil || c.pre(n, parent) {
  1661  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  1662  		_Fsp, changedFsp := c.copyOnRewriteExpr(n.Fsp, n)
  1663  		if changedName || changedFsp {
  1664  			res := *n
  1665  			res.Name, _ = _Name.(IdentifierCI)
  1666  			res.Fsp, _ = _Fsp.(Expr)
  1667  			out = &res
  1668  			if c.cloned != nil {
  1669  				c.cloned(n, out)
  1670  			}
  1671  			changed = true
  1672  		}
  1673  	}
  1674  	if c.post != nil {
  1675  		out, changed = c.postVisit(out, parent, changed)
  1676  	}
  1677  	return
  1678  }
  1679  func (c *cow) copyOnRewriteRefOfDeallocateStmt(n *DeallocateStmt, parent SQLNode) (out SQLNode, changed bool) {
  1680  	if n == nil || c.cursor.stop {
  1681  		return n, false
  1682  	}
  1683  	out = n
  1684  	if c.pre == nil || c.pre(n, parent) {
  1685  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1686  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  1687  		if changedComments || changedName {
  1688  			res := *n
  1689  			res.Comments, _ = _Comments.(*ParsedComments)
  1690  			res.Name, _ = _Name.(IdentifierCI)
  1691  			out = &res
  1692  			if c.cloned != nil {
  1693  				c.cloned(n, out)
  1694  			}
  1695  			changed = true
  1696  		}
  1697  	}
  1698  	if c.post != nil {
  1699  		out, changed = c.postVisit(out, parent, changed)
  1700  	}
  1701  	return
  1702  }
  1703  func (c *cow) copyOnRewriteRefOfDefault(n *Default, parent SQLNode) (out SQLNode, changed bool) {
  1704  	if n == nil || c.cursor.stop {
  1705  		return n, false
  1706  	}
  1707  	out = n
  1708  	if c.pre == nil || c.pre(n, parent) {
  1709  	}
  1710  	if c.post != nil {
  1711  		out, changed = c.postVisit(out, parent, changed)
  1712  	}
  1713  	return
  1714  }
  1715  func (c *cow) copyOnRewriteRefOfDefiner(n *Definer, parent SQLNode) (out SQLNode, changed bool) {
  1716  	if n == nil || c.cursor.stop {
  1717  		return n, false
  1718  	}
  1719  	out = n
  1720  	if c.pre == nil || c.pre(n, parent) {
  1721  	}
  1722  	if c.post != nil {
  1723  		out, changed = c.postVisit(out, parent, changed)
  1724  	}
  1725  	return
  1726  }
  1727  func (c *cow) copyOnRewriteRefOfDelete(n *Delete, parent SQLNode) (out SQLNode, changed bool) {
  1728  	if n == nil || c.cursor.stop {
  1729  		return n, false
  1730  	}
  1731  	out = n
  1732  	if c.pre == nil || c.pre(n, parent) {
  1733  		_With, changedWith := c.copyOnRewriteRefOfWith(n.With, n)
  1734  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1735  		_Targets, changedTargets := c.copyOnRewriteTableNames(n.Targets, n)
  1736  		_TableExprs, changedTableExprs := c.copyOnRewriteTableExprs(n.TableExprs, n)
  1737  		_Partitions, changedPartitions := c.copyOnRewritePartitions(n.Partitions, n)
  1738  		_Where, changedWhere := c.copyOnRewriteRefOfWhere(n.Where, n)
  1739  		_OrderBy, changedOrderBy := c.copyOnRewriteOrderBy(n.OrderBy, n)
  1740  		_Limit, changedLimit := c.copyOnRewriteRefOfLimit(n.Limit, n)
  1741  		if changedWith || changedComments || changedTargets || changedTableExprs || changedPartitions || changedWhere || changedOrderBy || changedLimit {
  1742  			res := *n
  1743  			res.With, _ = _With.(*With)
  1744  			res.Comments, _ = _Comments.(*ParsedComments)
  1745  			res.Targets, _ = _Targets.(TableNames)
  1746  			res.TableExprs, _ = _TableExprs.(TableExprs)
  1747  			res.Partitions, _ = _Partitions.(Partitions)
  1748  			res.Where, _ = _Where.(*Where)
  1749  			res.OrderBy, _ = _OrderBy.(OrderBy)
  1750  			res.Limit, _ = _Limit.(*Limit)
  1751  			out = &res
  1752  			if c.cloned != nil {
  1753  				c.cloned(n, out)
  1754  			}
  1755  			changed = true
  1756  		}
  1757  	}
  1758  	if c.post != nil {
  1759  		out, changed = c.postVisit(out, parent, changed)
  1760  	}
  1761  	return
  1762  }
  1763  func (c *cow) copyOnRewriteRefOfDerivedTable(n *DerivedTable, parent SQLNode) (out SQLNode, changed bool) {
  1764  	if n == nil || c.cursor.stop {
  1765  		return n, false
  1766  	}
  1767  	out = n
  1768  	if c.pre == nil || c.pre(n, parent) {
  1769  		_Select, changedSelect := c.copyOnRewriteSelectStatement(n.Select, n)
  1770  		if changedSelect {
  1771  			res := *n
  1772  			res.Select, _ = _Select.(SelectStatement)
  1773  			out = &res
  1774  			if c.cloned != nil {
  1775  				c.cloned(n, out)
  1776  			}
  1777  			changed = true
  1778  		}
  1779  	}
  1780  	if c.post != nil {
  1781  		out, changed = c.postVisit(out, parent, changed)
  1782  	}
  1783  	return
  1784  }
  1785  func (c *cow) copyOnRewriteRefOfDropColumn(n *DropColumn, parent SQLNode) (out SQLNode, changed bool) {
  1786  	if n == nil || c.cursor.stop {
  1787  		return n, false
  1788  	}
  1789  	out = n
  1790  	if c.pre == nil || c.pre(n, parent) {
  1791  		_Name, changedName := c.copyOnRewriteRefOfColName(n.Name, n)
  1792  		if changedName {
  1793  			res := *n
  1794  			res.Name, _ = _Name.(*ColName)
  1795  			out = &res
  1796  			if c.cloned != nil {
  1797  				c.cloned(n, out)
  1798  			}
  1799  			changed = true
  1800  		}
  1801  	}
  1802  	if c.post != nil {
  1803  		out, changed = c.postVisit(out, parent, changed)
  1804  	}
  1805  	return
  1806  }
  1807  func (c *cow) copyOnRewriteRefOfDropDatabase(n *DropDatabase, parent SQLNode) (out SQLNode, changed bool) {
  1808  	if n == nil || c.cursor.stop {
  1809  		return n, false
  1810  	}
  1811  	out = n
  1812  	if c.pre == nil || c.pre(n, parent) {
  1813  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1814  		_DBName, changedDBName := c.copyOnRewriteIdentifierCS(n.DBName, n)
  1815  		if changedComments || changedDBName {
  1816  			res := *n
  1817  			res.Comments, _ = _Comments.(*ParsedComments)
  1818  			res.DBName, _ = _DBName.(IdentifierCS)
  1819  			out = &res
  1820  			if c.cloned != nil {
  1821  				c.cloned(n, out)
  1822  			}
  1823  			changed = true
  1824  		}
  1825  	}
  1826  	if c.post != nil {
  1827  		out, changed = c.postVisit(out, parent, changed)
  1828  	}
  1829  	return
  1830  }
  1831  func (c *cow) copyOnRewriteRefOfDropKey(n *DropKey, parent SQLNode) (out SQLNode, changed bool) {
  1832  	if n == nil || c.cursor.stop {
  1833  		return n, false
  1834  	}
  1835  	out = n
  1836  	if c.pre == nil || c.pre(n, parent) {
  1837  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  1838  		if changedName {
  1839  			res := *n
  1840  			res.Name, _ = _Name.(IdentifierCI)
  1841  			out = &res
  1842  			if c.cloned != nil {
  1843  				c.cloned(n, out)
  1844  			}
  1845  			changed = true
  1846  		}
  1847  	}
  1848  	if c.post != nil {
  1849  		out, changed = c.postVisit(out, parent, changed)
  1850  	}
  1851  	return
  1852  }
  1853  func (c *cow) copyOnRewriteRefOfDropTable(n *DropTable, parent SQLNode) (out SQLNode, changed bool) {
  1854  	if n == nil || c.cursor.stop {
  1855  		return n, false
  1856  	}
  1857  	out = n
  1858  	if c.pre == nil || c.pre(n, parent) {
  1859  		_FromTables, changedFromTables := c.copyOnRewriteTableNames(n.FromTables, n)
  1860  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1861  		if changedFromTables || changedComments {
  1862  			res := *n
  1863  			res.FromTables, _ = _FromTables.(TableNames)
  1864  			res.Comments, _ = _Comments.(*ParsedComments)
  1865  			out = &res
  1866  			if c.cloned != nil {
  1867  				c.cloned(n, out)
  1868  			}
  1869  			changed = true
  1870  		}
  1871  	}
  1872  	if c.post != nil {
  1873  		out, changed = c.postVisit(out, parent, changed)
  1874  	}
  1875  	return
  1876  }
  1877  func (c *cow) copyOnRewriteRefOfDropView(n *DropView, parent SQLNode) (out SQLNode, changed bool) {
  1878  	if n == nil || c.cursor.stop {
  1879  		return n, false
  1880  	}
  1881  	out = n
  1882  	if c.pre == nil || c.pre(n, parent) {
  1883  		_FromTables, changedFromTables := c.copyOnRewriteTableNames(n.FromTables, n)
  1884  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1885  		if changedFromTables || changedComments {
  1886  			res := *n
  1887  			res.FromTables, _ = _FromTables.(TableNames)
  1888  			res.Comments, _ = _Comments.(*ParsedComments)
  1889  			out = &res
  1890  			if c.cloned != nil {
  1891  				c.cloned(n, out)
  1892  			}
  1893  			changed = true
  1894  		}
  1895  	}
  1896  	if c.post != nil {
  1897  		out, changed = c.postVisit(out, parent, changed)
  1898  	}
  1899  	return
  1900  }
  1901  func (c *cow) copyOnRewriteRefOfExecuteStmt(n *ExecuteStmt, parent SQLNode) (out SQLNode, changed bool) {
  1902  	if n == nil || c.cursor.stop {
  1903  		return n, false
  1904  	}
  1905  	out = n
  1906  	if c.pre == nil || c.pre(n, parent) {
  1907  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  1908  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1909  		var changedArguments bool
  1910  		_Arguments := make([]*Variable, len(n.Arguments))
  1911  		for x, el := range n.Arguments {
  1912  			this, changed := c.copyOnRewriteRefOfVariable(el, n)
  1913  			_Arguments[x] = this.(*Variable)
  1914  			if changed {
  1915  				changedArguments = true
  1916  			}
  1917  		}
  1918  		if changedName || changedComments || changedArguments {
  1919  			res := *n
  1920  			res.Name, _ = _Name.(IdentifierCI)
  1921  			res.Comments, _ = _Comments.(*ParsedComments)
  1922  			res.Arguments = _Arguments
  1923  			out = &res
  1924  			if c.cloned != nil {
  1925  				c.cloned(n, out)
  1926  			}
  1927  			changed = true
  1928  		}
  1929  	}
  1930  	if c.post != nil {
  1931  		out, changed = c.postVisit(out, parent, changed)
  1932  	}
  1933  	return
  1934  }
  1935  func (c *cow) copyOnRewriteRefOfExistsExpr(n *ExistsExpr, parent SQLNode) (out SQLNode, changed bool) {
  1936  	if n == nil || c.cursor.stop {
  1937  		return n, false
  1938  	}
  1939  	out = n
  1940  	if c.pre == nil || c.pre(n, parent) {
  1941  		_Subquery, changedSubquery := c.copyOnRewriteRefOfSubquery(n.Subquery, n)
  1942  		if changedSubquery {
  1943  			res := *n
  1944  			res.Subquery, _ = _Subquery.(*Subquery)
  1945  			out = &res
  1946  			if c.cloned != nil {
  1947  				c.cloned(n, out)
  1948  			}
  1949  			changed = true
  1950  		}
  1951  	}
  1952  	if c.post != nil {
  1953  		out, changed = c.postVisit(out, parent, changed)
  1954  	}
  1955  	return
  1956  }
  1957  func (c *cow) copyOnRewriteRefOfExplainStmt(n *ExplainStmt, parent SQLNode) (out SQLNode, changed bool) {
  1958  	if n == nil || c.cursor.stop {
  1959  		return n, false
  1960  	}
  1961  	out = n
  1962  	if c.pre == nil || c.pre(n, parent) {
  1963  		_Statement, changedStatement := c.copyOnRewriteStatement(n.Statement, n)
  1964  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  1965  		if changedStatement || changedComments {
  1966  			res := *n
  1967  			res.Statement, _ = _Statement.(Statement)
  1968  			res.Comments, _ = _Comments.(*ParsedComments)
  1969  			out = &res
  1970  			if c.cloned != nil {
  1971  				c.cloned(n, out)
  1972  			}
  1973  			changed = true
  1974  		}
  1975  	}
  1976  	if c.post != nil {
  1977  		out, changed = c.postVisit(out, parent, changed)
  1978  	}
  1979  	return
  1980  }
  1981  func (c *cow) copyOnRewriteRefOfExplainTab(n *ExplainTab, parent SQLNode) (out SQLNode, changed bool) {
  1982  	if n == nil || c.cursor.stop {
  1983  		return n, false
  1984  	}
  1985  	out = n
  1986  	if c.pre == nil || c.pre(n, parent) {
  1987  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
  1988  		if changedTable {
  1989  			res := *n
  1990  			res.Table, _ = _Table.(TableName)
  1991  			out = &res
  1992  			if c.cloned != nil {
  1993  				c.cloned(n, out)
  1994  			}
  1995  			changed = true
  1996  		}
  1997  	}
  1998  	if c.post != nil {
  1999  		out, changed = c.postVisit(out, parent, changed)
  2000  	}
  2001  	return
  2002  }
  2003  func (c *cow) copyOnRewriteExprs(n Exprs, parent SQLNode) (out SQLNode, changed bool) {
  2004  	if n == nil || c.cursor.stop {
  2005  		return n, false
  2006  	}
  2007  	out = n
  2008  	if c.pre == nil || c.pre(n, parent) {
  2009  		res := make(Exprs, len(n))
  2010  		for x, el := range n {
  2011  			this, change := c.copyOnRewriteExpr(el, n)
  2012  			res[x] = this.(Expr)
  2013  			if change {
  2014  				changed = true
  2015  			}
  2016  		}
  2017  		if changed {
  2018  			out = res
  2019  		}
  2020  	}
  2021  	if c.post != nil {
  2022  		out, changed = c.postVisit(out, parent, changed)
  2023  	}
  2024  	return
  2025  }
  2026  func (c *cow) copyOnRewriteRefOfExtractFuncExpr(n *ExtractFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  2027  	if n == nil || c.cursor.stop {
  2028  		return n, false
  2029  	}
  2030  	out = n
  2031  	if c.pre == nil || c.pre(n, parent) {
  2032  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  2033  		if changedExpr {
  2034  			res := *n
  2035  			res.Expr, _ = _Expr.(Expr)
  2036  			out = &res
  2037  			if c.cloned != nil {
  2038  				c.cloned(n, out)
  2039  			}
  2040  			changed = true
  2041  		}
  2042  	}
  2043  	if c.post != nil {
  2044  		out, changed = c.postVisit(out, parent, changed)
  2045  	}
  2046  	return
  2047  }
  2048  func (c *cow) copyOnRewriteRefOfExtractValueExpr(n *ExtractValueExpr, parent SQLNode) (out SQLNode, changed bool) {
  2049  	if n == nil || c.cursor.stop {
  2050  		return n, false
  2051  	}
  2052  	out = n
  2053  	if c.pre == nil || c.pre(n, parent) {
  2054  		_Fragment, changedFragment := c.copyOnRewriteExpr(n.Fragment, n)
  2055  		_XPathExpr, changedXPathExpr := c.copyOnRewriteExpr(n.XPathExpr, n)
  2056  		if changedFragment || changedXPathExpr {
  2057  			res := *n
  2058  			res.Fragment, _ = _Fragment.(Expr)
  2059  			res.XPathExpr, _ = _XPathExpr.(Expr)
  2060  			out = &res
  2061  			if c.cloned != nil {
  2062  				c.cloned(n, out)
  2063  			}
  2064  			changed = true
  2065  		}
  2066  	}
  2067  	if c.post != nil {
  2068  		out, changed = c.postVisit(out, parent, changed)
  2069  	}
  2070  	return
  2071  }
  2072  func (c *cow) copyOnRewriteRefOfExtractedSubquery(n *ExtractedSubquery, parent SQLNode) (out SQLNode, changed bool) {
  2073  	if n == nil || c.cursor.stop {
  2074  		return n, false
  2075  	}
  2076  	out = n
  2077  	if c.pre == nil || c.pre(n, parent) {
  2078  		_Original, changedOriginal := c.copyOnRewriteExpr(n.Original, n)
  2079  		_Subquery, changedSubquery := c.copyOnRewriteRefOfSubquery(n.Subquery, n)
  2080  		_OtherSide, changedOtherSide := c.copyOnRewriteExpr(n.OtherSide, n)
  2081  		_alternative, changedalternative := c.copyOnRewriteExpr(n.alternative, n)
  2082  		if changedOriginal || changedSubquery || changedOtherSide || changedalternative {
  2083  			res := *n
  2084  			res.Original, _ = _Original.(Expr)
  2085  			res.Subquery, _ = _Subquery.(*Subquery)
  2086  			res.OtherSide, _ = _OtherSide.(Expr)
  2087  			res.alternative, _ = _alternative.(Expr)
  2088  			out = &res
  2089  			if c.cloned != nil {
  2090  				c.cloned(n, out)
  2091  			}
  2092  			changed = true
  2093  		}
  2094  	}
  2095  	if c.post != nil {
  2096  		out, changed = c.postVisit(out, parent, changed)
  2097  	}
  2098  	return
  2099  }
  2100  func (c *cow) copyOnRewriteRefOfFirstOrLastValueExpr(n *FirstOrLastValueExpr, parent SQLNode) (out SQLNode, changed bool) {
  2101  	if n == nil || c.cursor.stop {
  2102  		return n, false
  2103  	}
  2104  	out = n
  2105  	if c.pre == nil || c.pre(n, parent) {
  2106  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  2107  		_NullTreatmentClause, changedNullTreatmentClause := c.copyOnRewriteRefOfNullTreatmentClause(n.NullTreatmentClause, n)
  2108  		_OverClause, changedOverClause := c.copyOnRewriteRefOfOverClause(n.OverClause, n)
  2109  		if changedExpr || changedNullTreatmentClause || changedOverClause {
  2110  			res := *n
  2111  			res.Expr, _ = _Expr.(Expr)
  2112  			res.NullTreatmentClause, _ = _NullTreatmentClause.(*NullTreatmentClause)
  2113  			res.OverClause, _ = _OverClause.(*OverClause)
  2114  			out = &res
  2115  			if c.cloned != nil {
  2116  				c.cloned(n, out)
  2117  			}
  2118  			changed = true
  2119  		}
  2120  	}
  2121  	if c.post != nil {
  2122  		out, changed = c.postVisit(out, parent, changed)
  2123  	}
  2124  	return
  2125  }
  2126  func (c *cow) copyOnRewriteRefOfFlush(n *Flush, parent SQLNode) (out SQLNode, changed bool) {
  2127  	if n == nil || c.cursor.stop {
  2128  		return n, false
  2129  	}
  2130  	out = n
  2131  	if c.pre == nil || c.pre(n, parent) {
  2132  		_TableNames, changedTableNames := c.copyOnRewriteTableNames(n.TableNames, n)
  2133  		if changedTableNames {
  2134  			res := *n
  2135  			res.TableNames, _ = _TableNames.(TableNames)
  2136  			out = &res
  2137  			if c.cloned != nil {
  2138  				c.cloned(n, out)
  2139  			}
  2140  			changed = true
  2141  		}
  2142  	}
  2143  	if c.post != nil {
  2144  		out, changed = c.postVisit(out, parent, changed)
  2145  	}
  2146  	return
  2147  }
  2148  func (c *cow) copyOnRewriteRefOfForce(n *Force, parent SQLNode) (out SQLNode, changed bool) {
  2149  	if n == nil || c.cursor.stop {
  2150  		return n, false
  2151  	}
  2152  	out = n
  2153  	if c.pre == nil || c.pre(n, parent) {
  2154  	}
  2155  	if c.post != nil {
  2156  		out, changed = c.postVisit(out, parent, changed)
  2157  	}
  2158  	return
  2159  }
  2160  func (c *cow) copyOnRewriteRefOfForeignKeyDefinition(n *ForeignKeyDefinition, parent SQLNode) (out SQLNode, changed bool) {
  2161  	if n == nil || c.cursor.stop {
  2162  		return n, false
  2163  	}
  2164  	out = n
  2165  	if c.pre == nil || c.pre(n, parent) {
  2166  		_Source, changedSource := c.copyOnRewriteColumns(n.Source, n)
  2167  		_IndexName, changedIndexName := c.copyOnRewriteIdentifierCI(n.IndexName, n)
  2168  		_ReferenceDefinition, changedReferenceDefinition := c.copyOnRewriteRefOfReferenceDefinition(n.ReferenceDefinition, n)
  2169  		if changedSource || changedIndexName || changedReferenceDefinition {
  2170  			res := *n
  2171  			res.Source, _ = _Source.(Columns)
  2172  			res.IndexName, _ = _IndexName.(IdentifierCI)
  2173  			res.ReferenceDefinition, _ = _ReferenceDefinition.(*ReferenceDefinition)
  2174  			out = &res
  2175  			if c.cloned != nil {
  2176  				c.cloned(n, out)
  2177  			}
  2178  			changed = true
  2179  		}
  2180  	}
  2181  	if c.post != nil {
  2182  		out, changed = c.postVisit(out, parent, changed)
  2183  	}
  2184  	return
  2185  }
  2186  func (c *cow) copyOnRewriteRefOfFrameClause(n *FrameClause, parent SQLNode) (out SQLNode, changed bool) {
  2187  	if n == nil || c.cursor.stop {
  2188  		return n, false
  2189  	}
  2190  	out = n
  2191  	if c.pre == nil || c.pre(n, parent) {
  2192  		_Start, changedStart := c.copyOnRewriteRefOfFramePoint(n.Start, n)
  2193  		_End, changedEnd := c.copyOnRewriteRefOfFramePoint(n.End, n)
  2194  		if changedStart || changedEnd {
  2195  			res := *n
  2196  			res.Start, _ = _Start.(*FramePoint)
  2197  			res.End, _ = _End.(*FramePoint)
  2198  			out = &res
  2199  			if c.cloned != nil {
  2200  				c.cloned(n, out)
  2201  			}
  2202  			changed = true
  2203  		}
  2204  	}
  2205  	if c.post != nil {
  2206  		out, changed = c.postVisit(out, parent, changed)
  2207  	}
  2208  	return
  2209  }
  2210  func (c *cow) copyOnRewriteRefOfFramePoint(n *FramePoint, parent SQLNode) (out SQLNode, changed bool) {
  2211  	if n == nil || c.cursor.stop {
  2212  		return n, false
  2213  	}
  2214  	out = n
  2215  	if c.pre == nil || c.pre(n, parent) {
  2216  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  2217  		if changedExpr {
  2218  			res := *n
  2219  			res.Expr, _ = _Expr.(Expr)
  2220  			out = &res
  2221  			if c.cloned != nil {
  2222  				c.cloned(n, out)
  2223  			}
  2224  			changed = true
  2225  		}
  2226  	}
  2227  	if c.post != nil {
  2228  		out, changed = c.postVisit(out, parent, changed)
  2229  	}
  2230  	return
  2231  }
  2232  func (c *cow) copyOnRewriteRefOfFromFirstLastClause(n *FromFirstLastClause, parent SQLNode) (out SQLNode, changed bool) {
  2233  	if n == nil || c.cursor.stop {
  2234  		return n, false
  2235  	}
  2236  	out = n
  2237  	if c.pre == nil || c.pre(n, parent) {
  2238  	}
  2239  	if c.post != nil {
  2240  		out, changed = c.postVisit(out, parent, changed)
  2241  	}
  2242  	return
  2243  }
  2244  func (c *cow) copyOnRewriteRefOfFuncExpr(n *FuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  2245  	if n == nil || c.cursor.stop {
  2246  		return n, false
  2247  	}
  2248  	out = n
  2249  	if c.pre == nil || c.pre(n, parent) {
  2250  		_Qualifier, changedQualifier := c.copyOnRewriteIdentifierCS(n.Qualifier, n)
  2251  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  2252  		_Exprs, changedExprs := c.copyOnRewriteSelectExprs(n.Exprs, n)
  2253  		if changedQualifier || changedName || changedExprs {
  2254  			res := *n
  2255  			res.Qualifier, _ = _Qualifier.(IdentifierCS)
  2256  			res.Name, _ = _Name.(IdentifierCI)
  2257  			res.Exprs, _ = _Exprs.(SelectExprs)
  2258  			out = &res
  2259  			if c.cloned != nil {
  2260  				c.cloned(n, out)
  2261  			}
  2262  			changed = true
  2263  		}
  2264  	}
  2265  	if c.post != nil {
  2266  		out, changed = c.postVisit(out, parent, changed)
  2267  	}
  2268  	return
  2269  }
  2270  func (c *cow) copyOnRewriteRefOfGTIDFuncExpr(n *GTIDFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  2271  	if n == nil || c.cursor.stop {
  2272  		return n, false
  2273  	}
  2274  	out = n
  2275  	if c.pre == nil || c.pre(n, parent) {
  2276  		_Set1, changedSet1 := c.copyOnRewriteExpr(n.Set1, n)
  2277  		_Set2, changedSet2 := c.copyOnRewriteExpr(n.Set2, n)
  2278  		_Timeout, changedTimeout := c.copyOnRewriteExpr(n.Timeout, n)
  2279  		_Channel, changedChannel := c.copyOnRewriteExpr(n.Channel, n)
  2280  		if changedSet1 || changedSet2 || changedTimeout || changedChannel {
  2281  			res := *n
  2282  			res.Set1, _ = _Set1.(Expr)
  2283  			res.Set2, _ = _Set2.(Expr)
  2284  			res.Timeout, _ = _Timeout.(Expr)
  2285  			res.Channel, _ = _Channel.(Expr)
  2286  			out = &res
  2287  			if c.cloned != nil {
  2288  				c.cloned(n, out)
  2289  			}
  2290  			changed = true
  2291  		}
  2292  	}
  2293  	if c.post != nil {
  2294  		out, changed = c.postVisit(out, parent, changed)
  2295  	}
  2296  	return
  2297  }
  2298  func (c *cow) copyOnRewriteGroupBy(n GroupBy, parent SQLNode) (out SQLNode, changed bool) {
  2299  	if n == nil || c.cursor.stop {
  2300  		return n, false
  2301  	}
  2302  	out = n
  2303  	if c.pre == nil || c.pre(n, parent) {
  2304  		res := make(GroupBy, len(n))
  2305  		for x, el := range n {
  2306  			this, change := c.copyOnRewriteExpr(el, n)
  2307  			res[x] = this.(Expr)
  2308  			if change {
  2309  				changed = true
  2310  			}
  2311  		}
  2312  		if changed {
  2313  			out = res
  2314  		}
  2315  	}
  2316  	if c.post != nil {
  2317  		out, changed = c.postVisit(out, parent, changed)
  2318  	}
  2319  	return
  2320  }
  2321  func (c *cow) copyOnRewriteRefOfGroupConcatExpr(n *GroupConcatExpr, parent SQLNode) (out SQLNode, changed bool) {
  2322  	if n == nil || c.cursor.stop {
  2323  		return n, false
  2324  	}
  2325  	out = n
  2326  	if c.pre == nil || c.pre(n, parent) {
  2327  		_Exprs, changedExprs := c.copyOnRewriteExprs(n.Exprs, n)
  2328  		_OrderBy, changedOrderBy := c.copyOnRewriteOrderBy(n.OrderBy, n)
  2329  		_Limit, changedLimit := c.copyOnRewriteRefOfLimit(n.Limit, n)
  2330  		if changedExprs || changedOrderBy || changedLimit {
  2331  			res := *n
  2332  			res.Exprs, _ = _Exprs.(Exprs)
  2333  			res.OrderBy, _ = _OrderBy.(OrderBy)
  2334  			res.Limit, _ = _Limit.(*Limit)
  2335  			out = &res
  2336  			if c.cloned != nil {
  2337  				c.cloned(n, out)
  2338  			}
  2339  			changed = true
  2340  		}
  2341  	}
  2342  	if c.post != nil {
  2343  		out, changed = c.postVisit(out, parent, changed)
  2344  	}
  2345  	return
  2346  }
  2347  func (c *cow) copyOnRewriteIdentifierCI(n IdentifierCI, parent SQLNode) (out SQLNode, changed bool) {
  2348  	out = n
  2349  	if c.pre == nil || c.pre(n, parent) {
  2350  	}
  2351  	if c.post != nil {
  2352  		out, changed = c.postVisit(out, parent, changed)
  2353  	}
  2354  	return
  2355  }
  2356  func (c *cow) copyOnRewriteIdentifierCS(n IdentifierCS, parent SQLNode) (out SQLNode, changed bool) {
  2357  	out = n
  2358  	if c.pre == nil || c.pre(n, parent) {
  2359  	}
  2360  	if c.post != nil {
  2361  		out, changed = c.postVisit(out, parent, changed)
  2362  	}
  2363  	return
  2364  }
  2365  func (c *cow) copyOnRewriteRefOfIndexDefinition(n *IndexDefinition, parent SQLNode) (out SQLNode, changed bool) {
  2366  	if n == nil || c.cursor.stop {
  2367  		return n, false
  2368  	}
  2369  	out = n
  2370  	if c.pre == nil || c.pre(n, parent) {
  2371  		_Info, changedInfo := c.copyOnRewriteRefOfIndexInfo(n.Info, n)
  2372  		if changedInfo {
  2373  			res := *n
  2374  			res.Info, _ = _Info.(*IndexInfo)
  2375  			out = &res
  2376  			if c.cloned != nil {
  2377  				c.cloned(n, out)
  2378  			}
  2379  			changed = true
  2380  		}
  2381  	}
  2382  	if c.post != nil {
  2383  		out, changed = c.postVisit(out, parent, changed)
  2384  	}
  2385  	return
  2386  }
  2387  func (c *cow) copyOnRewriteRefOfIndexHint(n *IndexHint, parent SQLNode) (out SQLNode, changed bool) {
  2388  	if n == nil || c.cursor.stop {
  2389  		return n, false
  2390  	}
  2391  	out = n
  2392  	if c.pre == nil || c.pre(n, parent) {
  2393  		var changedIndexes bool
  2394  		_Indexes := make([]IdentifierCI, len(n.Indexes))
  2395  		for x, el := range n.Indexes {
  2396  			this, changed := c.copyOnRewriteIdentifierCI(el, n)
  2397  			_Indexes[x] = this.(IdentifierCI)
  2398  			if changed {
  2399  				changedIndexes = true
  2400  			}
  2401  		}
  2402  		if changedIndexes {
  2403  			res := *n
  2404  			res.Indexes = _Indexes
  2405  			out = &res
  2406  			if c.cloned != nil {
  2407  				c.cloned(n, out)
  2408  			}
  2409  			changed = true
  2410  		}
  2411  	}
  2412  	if c.post != nil {
  2413  		out, changed = c.postVisit(out, parent, changed)
  2414  	}
  2415  	return
  2416  }
  2417  func (c *cow) copyOnRewriteIndexHints(n IndexHints, parent SQLNode) (out SQLNode, changed bool) {
  2418  	if n == nil || c.cursor.stop {
  2419  		return n, false
  2420  	}
  2421  	out = n
  2422  	if c.pre == nil || c.pre(n, parent) {
  2423  		res := make(IndexHints, len(n))
  2424  		for x, el := range n {
  2425  			this, change := c.copyOnRewriteRefOfIndexHint(el, n)
  2426  			res[x] = this.(*IndexHint)
  2427  			if change {
  2428  				changed = true
  2429  			}
  2430  		}
  2431  		if changed {
  2432  			out = res
  2433  		}
  2434  	}
  2435  	if c.post != nil {
  2436  		out, changed = c.postVisit(out, parent, changed)
  2437  	}
  2438  	return
  2439  }
  2440  func (c *cow) copyOnRewriteRefOfIndexInfo(n *IndexInfo, parent SQLNode) (out SQLNode, changed bool) {
  2441  	if n == nil || c.cursor.stop {
  2442  		return n, false
  2443  	}
  2444  	out = n
  2445  	if c.pre == nil || c.pre(n, parent) {
  2446  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  2447  		_ConstraintName, changedConstraintName := c.copyOnRewriteIdentifierCI(n.ConstraintName, n)
  2448  		if changedName || changedConstraintName {
  2449  			res := *n
  2450  			res.Name, _ = _Name.(IdentifierCI)
  2451  			res.ConstraintName, _ = _ConstraintName.(IdentifierCI)
  2452  			out = &res
  2453  			if c.cloned != nil {
  2454  				c.cloned(n, out)
  2455  			}
  2456  			changed = true
  2457  		}
  2458  	}
  2459  	if c.post != nil {
  2460  		out, changed = c.postVisit(out, parent, changed)
  2461  	}
  2462  	return
  2463  }
  2464  func (c *cow) copyOnRewriteRefOfInsert(n *Insert, parent SQLNode) (out SQLNode, changed bool) {
  2465  	if n == nil || c.cursor.stop {
  2466  		return n, false
  2467  	}
  2468  	out = n
  2469  	if c.pre == nil || c.pre(n, parent) {
  2470  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  2471  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
  2472  		_Partitions, changedPartitions := c.copyOnRewritePartitions(n.Partitions, n)
  2473  		_Columns, changedColumns := c.copyOnRewriteColumns(n.Columns, n)
  2474  		_Rows, changedRows := c.copyOnRewriteInsertRows(n.Rows, n)
  2475  		_OnDup, changedOnDup := c.copyOnRewriteOnDup(n.OnDup, n)
  2476  		if changedComments || changedTable || changedPartitions || changedColumns || changedRows || changedOnDup {
  2477  			res := *n
  2478  			res.Comments, _ = _Comments.(*ParsedComments)
  2479  			res.Table, _ = _Table.(TableName)
  2480  			res.Partitions, _ = _Partitions.(Partitions)
  2481  			res.Columns, _ = _Columns.(Columns)
  2482  			res.Rows, _ = _Rows.(InsertRows)
  2483  			res.OnDup, _ = _OnDup.(OnDup)
  2484  			out = &res
  2485  			if c.cloned != nil {
  2486  				c.cloned(n, out)
  2487  			}
  2488  			changed = true
  2489  		}
  2490  	}
  2491  	if c.post != nil {
  2492  		out, changed = c.postVisit(out, parent, changed)
  2493  	}
  2494  	return
  2495  }
  2496  func (c *cow) copyOnRewriteRefOfInsertExpr(n *InsertExpr, parent SQLNode) (out SQLNode, changed bool) {
  2497  	if n == nil || c.cursor.stop {
  2498  		return n, false
  2499  	}
  2500  	out = n
  2501  	if c.pre == nil || c.pre(n, parent) {
  2502  		_Str, changedStr := c.copyOnRewriteExpr(n.Str, n)
  2503  		_Pos, changedPos := c.copyOnRewriteExpr(n.Pos, n)
  2504  		_Len, changedLen := c.copyOnRewriteExpr(n.Len, n)
  2505  		_NewStr, changedNewStr := c.copyOnRewriteExpr(n.NewStr, n)
  2506  		if changedStr || changedPos || changedLen || changedNewStr {
  2507  			res := *n
  2508  			res.Str, _ = _Str.(Expr)
  2509  			res.Pos, _ = _Pos.(Expr)
  2510  			res.Len, _ = _Len.(Expr)
  2511  			res.NewStr, _ = _NewStr.(Expr)
  2512  			out = &res
  2513  			if c.cloned != nil {
  2514  				c.cloned(n, out)
  2515  			}
  2516  			changed = true
  2517  		}
  2518  	}
  2519  	if c.post != nil {
  2520  		out, changed = c.postVisit(out, parent, changed)
  2521  	}
  2522  	return
  2523  }
  2524  func (c *cow) copyOnRewriteRefOfIntervalExpr(n *IntervalExpr, parent SQLNode) (out SQLNode, changed bool) {
  2525  	if n == nil || c.cursor.stop {
  2526  		return n, false
  2527  	}
  2528  	out = n
  2529  	if c.pre == nil || c.pre(n, parent) {
  2530  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  2531  		if changedExpr {
  2532  			res := *n
  2533  			res.Expr, _ = _Expr.(Expr)
  2534  			out = &res
  2535  			if c.cloned != nil {
  2536  				c.cloned(n, out)
  2537  			}
  2538  			changed = true
  2539  		}
  2540  	}
  2541  	if c.post != nil {
  2542  		out, changed = c.postVisit(out, parent, changed)
  2543  	}
  2544  	return
  2545  }
  2546  func (c *cow) copyOnRewriteRefOfIntervalFuncExpr(n *IntervalFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  2547  	if n == nil || c.cursor.stop {
  2548  		return n, false
  2549  	}
  2550  	out = n
  2551  	if c.pre == nil || c.pre(n, parent) {
  2552  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  2553  		_Exprs, changedExprs := c.copyOnRewriteExprs(n.Exprs, n)
  2554  		if changedExpr || changedExprs {
  2555  			res := *n
  2556  			res.Expr, _ = _Expr.(Expr)
  2557  			res.Exprs, _ = _Exprs.(Exprs)
  2558  			out = &res
  2559  			if c.cloned != nil {
  2560  				c.cloned(n, out)
  2561  			}
  2562  			changed = true
  2563  		}
  2564  	}
  2565  	if c.post != nil {
  2566  		out, changed = c.postVisit(out, parent, changed)
  2567  	}
  2568  	return
  2569  }
  2570  func (c *cow) copyOnRewriteRefOfIntroducerExpr(n *IntroducerExpr, parent SQLNode) (out SQLNode, changed bool) {
  2571  	if n == nil || c.cursor.stop {
  2572  		return n, false
  2573  	}
  2574  	out = n
  2575  	if c.pre == nil || c.pre(n, parent) {
  2576  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  2577  		if changedExpr {
  2578  			res := *n
  2579  			res.Expr, _ = _Expr.(Expr)
  2580  			out = &res
  2581  			if c.cloned != nil {
  2582  				c.cloned(n, out)
  2583  			}
  2584  			changed = true
  2585  		}
  2586  	}
  2587  	if c.post != nil {
  2588  		out, changed = c.postVisit(out, parent, changed)
  2589  	}
  2590  	return
  2591  }
  2592  func (c *cow) copyOnRewriteRefOfIsExpr(n *IsExpr, parent SQLNode) (out SQLNode, changed bool) {
  2593  	if n == nil || c.cursor.stop {
  2594  		return n, false
  2595  	}
  2596  	out = n
  2597  	if c.pre == nil || c.pre(n, parent) {
  2598  		_Left, changedLeft := c.copyOnRewriteExpr(n.Left, n)
  2599  		if changedLeft {
  2600  			res := *n
  2601  			res.Left, _ = _Left.(Expr)
  2602  			out = &res
  2603  			if c.cloned != nil {
  2604  				c.cloned(n, out)
  2605  			}
  2606  			changed = true
  2607  		}
  2608  	}
  2609  	if c.post != nil {
  2610  		out, changed = c.postVisit(out, parent, changed)
  2611  	}
  2612  	return
  2613  }
  2614  func (c *cow) copyOnRewriteRefOfJSONArrayExpr(n *JSONArrayExpr, parent SQLNode) (out SQLNode, changed bool) {
  2615  	if n == nil || c.cursor.stop {
  2616  		return n, false
  2617  	}
  2618  	out = n
  2619  	if c.pre == nil || c.pre(n, parent) {
  2620  		_Params, changedParams := c.copyOnRewriteExprs(n.Params, n)
  2621  		if changedParams {
  2622  			res := *n
  2623  			res.Params, _ = _Params.(Exprs)
  2624  			out = &res
  2625  			if c.cloned != nil {
  2626  				c.cloned(n, out)
  2627  			}
  2628  			changed = true
  2629  		}
  2630  	}
  2631  	if c.post != nil {
  2632  		out, changed = c.postVisit(out, parent, changed)
  2633  	}
  2634  	return
  2635  }
  2636  func (c *cow) copyOnRewriteRefOfJSONAttributesExpr(n *JSONAttributesExpr, parent SQLNode) (out SQLNode, changed bool) {
  2637  	if n == nil || c.cursor.stop {
  2638  		return n, false
  2639  	}
  2640  	out = n
  2641  	if c.pre == nil || c.pre(n, parent) {
  2642  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  2643  		_Path, changedPath := c.copyOnRewriteExpr(n.Path, n)
  2644  		if changedJSONDoc || changedPath {
  2645  			res := *n
  2646  			res.JSONDoc, _ = _JSONDoc.(Expr)
  2647  			res.Path, _ = _Path.(Expr)
  2648  			out = &res
  2649  			if c.cloned != nil {
  2650  				c.cloned(n, out)
  2651  			}
  2652  			changed = true
  2653  		}
  2654  	}
  2655  	if c.post != nil {
  2656  		out, changed = c.postVisit(out, parent, changed)
  2657  	}
  2658  	return
  2659  }
  2660  func (c *cow) copyOnRewriteRefOfJSONContainsExpr(n *JSONContainsExpr, parent SQLNode) (out SQLNode, changed bool) {
  2661  	if n == nil || c.cursor.stop {
  2662  		return n, false
  2663  	}
  2664  	out = n
  2665  	if c.pre == nil || c.pre(n, parent) {
  2666  		_Target, changedTarget := c.copyOnRewriteExpr(n.Target, n)
  2667  		_Candidate, changedCandidate := c.copyOnRewriteExpr(n.Candidate, n)
  2668  		var changedPathList bool
  2669  		_PathList := make([]Expr, len(n.PathList))
  2670  		for x, el := range n.PathList {
  2671  			this, changed := c.copyOnRewriteExpr(el, n)
  2672  			_PathList[x] = this.(Expr)
  2673  			if changed {
  2674  				changedPathList = true
  2675  			}
  2676  		}
  2677  		if changedTarget || changedCandidate || changedPathList {
  2678  			res := *n
  2679  			res.Target, _ = _Target.(Expr)
  2680  			res.Candidate, _ = _Candidate.(Expr)
  2681  			res.PathList = _PathList
  2682  			out = &res
  2683  			if c.cloned != nil {
  2684  				c.cloned(n, out)
  2685  			}
  2686  			changed = true
  2687  		}
  2688  	}
  2689  	if c.post != nil {
  2690  		out, changed = c.postVisit(out, parent, changed)
  2691  	}
  2692  	return
  2693  }
  2694  func (c *cow) copyOnRewriteRefOfJSONContainsPathExpr(n *JSONContainsPathExpr, parent SQLNode) (out SQLNode, changed bool) {
  2695  	if n == nil || c.cursor.stop {
  2696  		return n, false
  2697  	}
  2698  	out = n
  2699  	if c.pre == nil || c.pre(n, parent) {
  2700  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  2701  		_OneOrAll, changedOneOrAll := c.copyOnRewriteExpr(n.OneOrAll, n)
  2702  		var changedPathList bool
  2703  		_PathList := make([]Expr, len(n.PathList))
  2704  		for x, el := range n.PathList {
  2705  			this, changed := c.copyOnRewriteExpr(el, n)
  2706  			_PathList[x] = this.(Expr)
  2707  			if changed {
  2708  				changedPathList = true
  2709  			}
  2710  		}
  2711  		if changedJSONDoc || changedOneOrAll || changedPathList {
  2712  			res := *n
  2713  			res.JSONDoc, _ = _JSONDoc.(Expr)
  2714  			res.OneOrAll, _ = _OneOrAll.(Expr)
  2715  			res.PathList = _PathList
  2716  			out = &res
  2717  			if c.cloned != nil {
  2718  				c.cloned(n, out)
  2719  			}
  2720  			changed = true
  2721  		}
  2722  	}
  2723  	if c.post != nil {
  2724  		out, changed = c.postVisit(out, parent, changed)
  2725  	}
  2726  	return
  2727  }
  2728  func (c *cow) copyOnRewriteRefOfJSONExtractExpr(n *JSONExtractExpr, parent SQLNode) (out SQLNode, changed bool) {
  2729  	if n == nil || c.cursor.stop {
  2730  		return n, false
  2731  	}
  2732  	out = n
  2733  	if c.pre == nil || c.pre(n, parent) {
  2734  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  2735  		var changedPathList bool
  2736  		_PathList := make([]Expr, len(n.PathList))
  2737  		for x, el := range n.PathList {
  2738  			this, changed := c.copyOnRewriteExpr(el, n)
  2739  			_PathList[x] = this.(Expr)
  2740  			if changed {
  2741  				changedPathList = true
  2742  			}
  2743  		}
  2744  		if changedJSONDoc || changedPathList {
  2745  			res := *n
  2746  			res.JSONDoc, _ = _JSONDoc.(Expr)
  2747  			res.PathList = _PathList
  2748  			out = &res
  2749  			if c.cloned != nil {
  2750  				c.cloned(n, out)
  2751  			}
  2752  			changed = true
  2753  		}
  2754  	}
  2755  	if c.post != nil {
  2756  		out, changed = c.postVisit(out, parent, changed)
  2757  	}
  2758  	return
  2759  }
  2760  func (c *cow) copyOnRewriteRefOfJSONKeysExpr(n *JSONKeysExpr, parent SQLNode) (out SQLNode, changed bool) {
  2761  	if n == nil || c.cursor.stop {
  2762  		return n, false
  2763  	}
  2764  	out = n
  2765  	if c.pre == nil || c.pre(n, parent) {
  2766  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  2767  		_Path, changedPath := c.copyOnRewriteExpr(n.Path, n)
  2768  		if changedJSONDoc || changedPath {
  2769  			res := *n
  2770  			res.JSONDoc, _ = _JSONDoc.(Expr)
  2771  			res.Path, _ = _Path.(Expr)
  2772  			out = &res
  2773  			if c.cloned != nil {
  2774  				c.cloned(n, out)
  2775  			}
  2776  			changed = true
  2777  		}
  2778  	}
  2779  	if c.post != nil {
  2780  		out, changed = c.postVisit(out, parent, changed)
  2781  	}
  2782  	return
  2783  }
  2784  func (c *cow) copyOnRewriteRefOfJSONObjectExpr(n *JSONObjectExpr, parent SQLNode) (out SQLNode, changed bool) {
  2785  	if n == nil || c.cursor.stop {
  2786  		return n, false
  2787  	}
  2788  	out = n
  2789  	if c.pre == nil || c.pre(n, parent) {
  2790  		var changedParams bool
  2791  		_Params := make([]*JSONObjectParam, len(n.Params))
  2792  		for x, el := range n.Params {
  2793  			this, changed := c.copyOnRewriteRefOfJSONObjectParam(el, n)
  2794  			_Params[x] = this.(*JSONObjectParam)
  2795  			if changed {
  2796  				changedParams = true
  2797  			}
  2798  		}
  2799  		if changedParams {
  2800  			res := *n
  2801  			res.Params = _Params
  2802  			out = &res
  2803  			if c.cloned != nil {
  2804  				c.cloned(n, out)
  2805  			}
  2806  			changed = true
  2807  		}
  2808  	}
  2809  	if c.post != nil {
  2810  		out, changed = c.postVisit(out, parent, changed)
  2811  	}
  2812  	return
  2813  }
  2814  func (c *cow) copyOnRewriteRefOfJSONObjectParam(n *JSONObjectParam, parent SQLNode) (out SQLNode, changed bool) {
  2815  	if n == nil || c.cursor.stop {
  2816  		return n, false
  2817  	}
  2818  	out = n
  2819  	if c.pre == nil || c.pre(n, parent) {
  2820  		_Key, changedKey := c.copyOnRewriteExpr(n.Key, n)
  2821  		_Value, changedValue := c.copyOnRewriteExpr(n.Value, n)
  2822  		if changedKey || changedValue {
  2823  			res := *n
  2824  			res.Key, _ = _Key.(Expr)
  2825  			res.Value, _ = _Value.(Expr)
  2826  			out = &res
  2827  			if c.cloned != nil {
  2828  				c.cloned(n, out)
  2829  			}
  2830  			changed = true
  2831  		}
  2832  	}
  2833  	if c.post != nil {
  2834  		out, changed = c.postVisit(out, parent, changed)
  2835  	}
  2836  	return
  2837  }
  2838  func (c *cow) copyOnRewriteRefOfJSONOverlapsExpr(n *JSONOverlapsExpr, parent SQLNode) (out SQLNode, changed bool) {
  2839  	if n == nil || c.cursor.stop {
  2840  		return n, false
  2841  	}
  2842  	out = n
  2843  	if c.pre == nil || c.pre(n, parent) {
  2844  		_JSONDoc1, changedJSONDoc1 := c.copyOnRewriteExpr(n.JSONDoc1, n)
  2845  		_JSONDoc2, changedJSONDoc2 := c.copyOnRewriteExpr(n.JSONDoc2, n)
  2846  		if changedJSONDoc1 || changedJSONDoc2 {
  2847  			res := *n
  2848  			res.JSONDoc1, _ = _JSONDoc1.(Expr)
  2849  			res.JSONDoc2, _ = _JSONDoc2.(Expr)
  2850  			out = &res
  2851  			if c.cloned != nil {
  2852  				c.cloned(n, out)
  2853  			}
  2854  			changed = true
  2855  		}
  2856  	}
  2857  	if c.post != nil {
  2858  		out, changed = c.postVisit(out, parent, changed)
  2859  	}
  2860  	return
  2861  }
  2862  func (c *cow) copyOnRewriteRefOfJSONPrettyExpr(n *JSONPrettyExpr, parent SQLNode) (out SQLNode, changed bool) {
  2863  	if n == nil || c.cursor.stop {
  2864  		return n, false
  2865  	}
  2866  	out = n
  2867  	if c.pre == nil || c.pre(n, parent) {
  2868  		_JSONVal, changedJSONVal := c.copyOnRewriteExpr(n.JSONVal, n)
  2869  		if changedJSONVal {
  2870  			res := *n
  2871  			res.JSONVal, _ = _JSONVal.(Expr)
  2872  			out = &res
  2873  			if c.cloned != nil {
  2874  				c.cloned(n, out)
  2875  			}
  2876  			changed = true
  2877  		}
  2878  	}
  2879  	if c.post != nil {
  2880  		out, changed = c.postVisit(out, parent, changed)
  2881  	}
  2882  	return
  2883  }
  2884  func (c *cow) copyOnRewriteRefOfJSONQuoteExpr(n *JSONQuoteExpr, parent SQLNode) (out SQLNode, changed bool) {
  2885  	if n == nil || c.cursor.stop {
  2886  		return n, false
  2887  	}
  2888  	out = n
  2889  	if c.pre == nil || c.pre(n, parent) {
  2890  		_StringArg, changedStringArg := c.copyOnRewriteExpr(n.StringArg, n)
  2891  		if changedStringArg {
  2892  			res := *n
  2893  			res.StringArg, _ = _StringArg.(Expr)
  2894  			out = &res
  2895  			if c.cloned != nil {
  2896  				c.cloned(n, out)
  2897  			}
  2898  			changed = true
  2899  		}
  2900  	}
  2901  	if c.post != nil {
  2902  		out, changed = c.postVisit(out, parent, changed)
  2903  	}
  2904  	return
  2905  }
  2906  func (c *cow) copyOnRewriteRefOfJSONRemoveExpr(n *JSONRemoveExpr, parent SQLNode) (out SQLNode, changed bool) {
  2907  	if n == nil || c.cursor.stop {
  2908  		return n, false
  2909  	}
  2910  	out = n
  2911  	if c.pre == nil || c.pre(n, parent) {
  2912  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  2913  		_PathList, changedPathList := c.copyOnRewriteExprs(n.PathList, n)
  2914  		if changedJSONDoc || changedPathList {
  2915  			res := *n
  2916  			res.JSONDoc, _ = _JSONDoc.(Expr)
  2917  			res.PathList, _ = _PathList.(Exprs)
  2918  			out = &res
  2919  			if c.cloned != nil {
  2920  				c.cloned(n, out)
  2921  			}
  2922  			changed = true
  2923  		}
  2924  	}
  2925  	if c.post != nil {
  2926  		out, changed = c.postVisit(out, parent, changed)
  2927  	}
  2928  	return
  2929  }
  2930  func (c *cow) copyOnRewriteRefOfJSONSchemaValidFuncExpr(n *JSONSchemaValidFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  2931  	if n == nil || c.cursor.stop {
  2932  		return n, false
  2933  	}
  2934  	out = n
  2935  	if c.pre == nil || c.pre(n, parent) {
  2936  		_Schema, changedSchema := c.copyOnRewriteExpr(n.Schema, n)
  2937  		_Document, changedDocument := c.copyOnRewriteExpr(n.Document, n)
  2938  		if changedSchema || changedDocument {
  2939  			res := *n
  2940  			res.Schema, _ = _Schema.(Expr)
  2941  			res.Document, _ = _Document.(Expr)
  2942  			out = &res
  2943  			if c.cloned != nil {
  2944  				c.cloned(n, out)
  2945  			}
  2946  			changed = true
  2947  		}
  2948  	}
  2949  	if c.post != nil {
  2950  		out, changed = c.postVisit(out, parent, changed)
  2951  	}
  2952  	return
  2953  }
  2954  func (c *cow) copyOnRewriteRefOfJSONSchemaValidationReportFuncExpr(n *JSONSchemaValidationReportFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  2955  	if n == nil || c.cursor.stop {
  2956  		return n, false
  2957  	}
  2958  	out = n
  2959  	if c.pre == nil || c.pre(n, parent) {
  2960  		_Schema, changedSchema := c.copyOnRewriteExpr(n.Schema, n)
  2961  		_Document, changedDocument := c.copyOnRewriteExpr(n.Document, n)
  2962  		if changedSchema || changedDocument {
  2963  			res := *n
  2964  			res.Schema, _ = _Schema.(Expr)
  2965  			res.Document, _ = _Document.(Expr)
  2966  			out = &res
  2967  			if c.cloned != nil {
  2968  				c.cloned(n, out)
  2969  			}
  2970  			changed = true
  2971  		}
  2972  	}
  2973  	if c.post != nil {
  2974  		out, changed = c.postVisit(out, parent, changed)
  2975  	}
  2976  	return
  2977  }
  2978  func (c *cow) copyOnRewriteRefOfJSONSearchExpr(n *JSONSearchExpr, parent SQLNode) (out SQLNode, changed bool) {
  2979  	if n == nil || c.cursor.stop {
  2980  		return n, false
  2981  	}
  2982  	out = n
  2983  	if c.pre == nil || c.pre(n, parent) {
  2984  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  2985  		_OneOrAll, changedOneOrAll := c.copyOnRewriteExpr(n.OneOrAll, n)
  2986  		_SearchStr, changedSearchStr := c.copyOnRewriteExpr(n.SearchStr, n)
  2987  		_EscapeChar, changedEscapeChar := c.copyOnRewriteExpr(n.EscapeChar, n)
  2988  		var changedPathList bool
  2989  		_PathList := make([]Expr, len(n.PathList))
  2990  		for x, el := range n.PathList {
  2991  			this, changed := c.copyOnRewriteExpr(el, n)
  2992  			_PathList[x] = this.(Expr)
  2993  			if changed {
  2994  				changedPathList = true
  2995  			}
  2996  		}
  2997  		if changedJSONDoc || changedOneOrAll || changedSearchStr || changedEscapeChar || changedPathList {
  2998  			res := *n
  2999  			res.JSONDoc, _ = _JSONDoc.(Expr)
  3000  			res.OneOrAll, _ = _OneOrAll.(Expr)
  3001  			res.SearchStr, _ = _SearchStr.(Expr)
  3002  			res.EscapeChar, _ = _EscapeChar.(Expr)
  3003  			res.PathList = _PathList
  3004  			out = &res
  3005  			if c.cloned != nil {
  3006  				c.cloned(n, out)
  3007  			}
  3008  			changed = true
  3009  		}
  3010  	}
  3011  	if c.post != nil {
  3012  		out, changed = c.postVisit(out, parent, changed)
  3013  	}
  3014  	return
  3015  }
  3016  func (c *cow) copyOnRewriteRefOfJSONStorageFreeExpr(n *JSONStorageFreeExpr, parent SQLNode) (out SQLNode, changed bool) {
  3017  	if n == nil || c.cursor.stop {
  3018  		return n, false
  3019  	}
  3020  	out = n
  3021  	if c.pre == nil || c.pre(n, parent) {
  3022  		_JSONVal, changedJSONVal := c.copyOnRewriteExpr(n.JSONVal, n)
  3023  		if changedJSONVal {
  3024  			res := *n
  3025  			res.JSONVal, _ = _JSONVal.(Expr)
  3026  			out = &res
  3027  			if c.cloned != nil {
  3028  				c.cloned(n, out)
  3029  			}
  3030  			changed = true
  3031  		}
  3032  	}
  3033  	if c.post != nil {
  3034  		out, changed = c.postVisit(out, parent, changed)
  3035  	}
  3036  	return
  3037  }
  3038  func (c *cow) copyOnRewriteRefOfJSONStorageSizeExpr(n *JSONStorageSizeExpr, parent SQLNode) (out SQLNode, changed bool) {
  3039  	if n == nil || c.cursor.stop {
  3040  		return n, false
  3041  	}
  3042  	out = n
  3043  	if c.pre == nil || c.pre(n, parent) {
  3044  		_JSONVal, changedJSONVal := c.copyOnRewriteExpr(n.JSONVal, n)
  3045  		if changedJSONVal {
  3046  			res := *n
  3047  			res.JSONVal, _ = _JSONVal.(Expr)
  3048  			out = &res
  3049  			if c.cloned != nil {
  3050  				c.cloned(n, out)
  3051  			}
  3052  			changed = true
  3053  		}
  3054  	}
  3055  	if c.post != nil {
  3056  		out, changed = c.postVisit(out, parent, changed)
  3057  	}
  3058  	return
  3059  }
  3060  func (c *cow) copyOnRewriteRefOfJSONTableExpr(n *JSONTableExpr, parent SQLNode) (out SQLNode, changed bool) {
  3061  	if n == nil || c.cursor.stop {
  3062  		return n, false
  3063  	}
  3064  	out = n
  3065  	if c.pre == nil || c.pre(n, parent) {
  3066  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3067  		_Alias, changedAlias := c.copyOnRewriteIdentifierCS(n.Alias, n)
  3068  		_Filter, changedFilter := c.copyOnRewriteExpr(n.Filter, n)
  3069  		var changedColumns bool
  3070  		_Columns := make([]*JtColumnDefinition, len(n.Columns))
  3071  		for x, el := range n.Columns {
  3072  			this, changed := c.copyOnRewriteRefOfJtColumnDefinition(el, n)
  3073  			_Columns[x] = this.(*JtColumnDefinition)
  3074  			if changed {
  3075  				changedColumns = true
  3076  			}
  3077  		}
  3078  		if changedExpr || changedAlias || changedFilter || changedColumns {
  3079  			res := *n
  3080  			res.Expr, _ = _Expr.(Expr)
  3081  			res.Alias, _ = _Alias.(IdentifierCS)
  3082  			res.Filter, _ = _Filter.(Expr)
  3083  			res.Columns = _Columns
  3084  			out = &res
  3085  			if c.cloned != nil {
  3086  				c.cloned(n, out)
  3087  			}
  3088  			changed = true
  3089  		}
  3090  	}
  3091  	if c.post != nil {
  3092  		out, changed = c.postVisit(out, parent, changed)
  3093  	}
  3094  	return
  3095  }
  3096  func (c *cow) copyOnRewriteRefOfJSONUnquoteExpr(n *JSONUnquoteExpr, parent SQLNode) (out SQLNode, changed bool) {
  3097  	if n == nil || c.cursor.stop {
  3098  		return n, false
  3099  	}
  3100  	out = n
  3101  	if c.pre == nil || c.pre(n, parent) {
  3102  		_JSONValue, changedJSONValue := c.copyOnRewriteExpr(n.JSONValue, n)
  3103  		if changedJSONValue {
  3104  			res := *n
  3105  			res.JSONValue, _ = _JSONValue.(Expr)
  3106  			out = &res
  3107  			if c.cloned != nil {
  3108  				c.cloned(n, out)
  3109  			}
  3110  			changed = true
  3111  		}
  3112  	}
  3113  	if c.post != nil {
  3114  		out, changed = c.postVisit(out, parent, changed)
  3115  	}
  3116  	return
  3117  }
  3118  func (c *cow) copyOnRewriteRefOfJSONValueExpr(n *JSONValueExpr, parent SQLNode) (out SQLNode, changed bool) {
  3119  	if n == nil || c.cursor.stop {
  3120  		return n, false
  3121  	}
  3122  	out = n
  3123  	if c.pre == nil || c.pre(n, parent) {
  3124  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  3125  		_Path, changedPath := c.copyOnRewriteExpr(n.Path, n)
  3126  		_ReturningType, changedReturningType := c.copyOnRewriteRefOfConvertType(n.ReturningType, n)
  3127  		_EmptyOnResponse, changedEmptyOnResponse := c.copyOnRewriteRefOfJtOnResponse(n.EmptyOnResponse, n)
  3128  		_ErrorOnResponse, changedErrorOnResponse := c.copyOnRewriteRefOfJtOnResponse(n.ErrorOnResponse, n)
  3129  		if changedJSONDoc || changedPath || changedReturningType || changedEmptyOnResponse || changedErrorOnResponse {
  3130  			res := *n
  3131  			res.JSONDoc, _ = _JSONDoc.(Expr)
  3132  			res.Path, _ = _Path.(Expr)
  3133  			res.ReturningType, _ = _ReturningType.(*ConvertType)
  3134  			res.EmptyOnResponse, _ = _EmptyOnResponse.(*JtOnResponse)
  3135  			res.ErrorOnResponse, _ = _ErrorOnResponse.(*JtOnResponse)
  3136  			out = &res
  3137  			if c.cloned != nil {
  3138  				c.cloned(n, out)
  3139  			}
  3140  			changed = true
  3141  		}
  3142  	}
  3143  	if c.post != nil {
  3144  		out, changed = c.postVisit(out, parent, changed)
  3145  	}
  3146  	return
  3147  }
  3148  func (c *cow) copyOnRewriteRefOfJSONValueMergeExpr(n *JSONValueMergeExpr, parent SQLNode) (out SQLNode, changed bool) {
  3149  	if n == nil || c.cursor.stop {
  3150  		return n, false
  3151  	}
  3152  	out = n
  3153  	if c.pre == nil || c.pre(n, parent) {
  3154  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  3155  		_JSONDocList, changedJSONDocList := c.copyOnRewriteExprs(n.JSONDocList, n)
  3156  		if changedJSONDoc || changedJSONDocList {
  3157  			res := *n
  3158  			res.JSONDoc, _ = _JSONDoc.(Expr)
  3159  			res.JSONDocList, _ = _JSONDocList.(Exprs)
  3160  			out = &res
  3161  			if c.cloned != nil {
  3162  				c.cloned(n, out)
  3163  			}
  3164  			changed = true
  3165  		}
  3166  	}
  3167  	if c.post != nil {
  3168  		out, changed = c.postVisit(out, parent, changed)
  3169  	}
  3170  	return
  3171  }
  3172  func (c *cow) copyOnRewriteRefOfJSONValueModifierExpr(n *JSONValueModifierExpr, parent SQLNode) (out SQLNode, changed bool) {
  3173  	if n == nil || c.cursor.stop {
  3174  		return n, false
  3175  	}
  3176  	out = n
  3177  	if c.pre == nil || c.pre(n, parent) {
  3178  		_JSONDoc, changedJSONDoc := c.copyOnRewriteExpr(n.JSONDoc, n)
  3179  		var changedParams bool
  3180  		_Params := make([]*JSONObjectParam, len(n.Params))
  3181  		for x, el := range n.Params {
  3182  			this, changed := c.copyOnRewriteRefOfJSONObjectParam(el, n)
  3183  			_Params[x] = this.(*JSONObjectParam)
  3184  			if changed {
  3185  				changedParams = true
  3186  			}
  3187  		}
  3188  		if changedJSONDoc || changedParams {
  3189  			res := *n
  3190  			res.JSONDoc, _ = _JSONDoc.(Expr)
  3191  			res.Params = _Params
  3192  			out = &res
  3193  			if c.cloned != nil {
  3194  				c.cloned(n, out)
  3195  			}
  3196  			changed = true
  3197  		}
  3198  	}
  3199  	if c.post != nil {
  3200  		out, changed = c.postVisit(out, parent, changed)
  3201  	}
  3202  	return
  3203  }
  3204  func (c *cow) copyOnRewriteRefOfJoinCondition(n *JoinCondition, parent SQLNode) (out SQLNode, changed bool) {
  3205  	if n == nil || c.cursor.stop {
  3206  		return n, false
  3207  	}
  3208  	out = n
  3209  	if c.pre == nil || c.pre(n, parent) {
  3210  		_On, changedOn := c.copyOnRewriteExpr(n.On, n)
  3211  		_Using, changedUsing := c.copyOnRewriteColumns(n.Using, n)
  3212  		if changedOn || changedUsing {
  3213  			res := *n
  3214  			res.On, _ = _On.(Expr)
  3215  			res.Using, _ = _Using.(Columns)
  3216  			out = &res
  3217  			if c.cloned != nil {
  3218  				c.cloned(n, out)
  3219  			}
  3220  			changed = true
  3221  		}
  3222  	}
  3223  	if c.post != nil {
  3224  		out, changed = c.postVisit(out, parent, changed)
  3225  	}
  3226  	return
  3227  }
  3228  func (c *cow) copyOnRewriteRefOfJoinTableExpr(n *JoinTableExpr, parent SQLNode) (out SQLNode, changed bool) {
  3229  	if n == nil || c.cursor.stop {
  3230  		return n, false
  3231  	}
  3232  	out = n
  3233  	if c.pre == nil || c.pre(n, parent) {
  3234  		_LeftExpr, changedLeftExpr := c.copyOnRewriteTableExpr(n.LeftExpr, n)
  3235  		_RightExpr, changedRightExpr := c.copyOnRewriteTableExpr(n.RightExpr, n)
  3236  		_Condition, changedCondition := c.copyOnRewriteRefOfJoinCondition(n.Condition, n)
  3237  		if changedLeftExpr || changedRightExpr || changedCondition {
  3238  			res := *n
  3239  			res.LeftExpr, _ = _LeftExpr.(TableExpr)
  3240  			res.RightExpr, _ = _RightExpr.(TableExpr)
  3241  			res.Condition, _ = _Condition.(*JoinCondition)
  3242  			out = &res
  3243  			if c.cloned != nil {
  3244  				c.cloned(n, out)
  3245  			}
  3246  			changed = true
  3247  		}
  3248  	}
  3249  	if c.post != nil {
  3250  		out, changed = c.postVisit(out, parent, changed)
  3251  	}
  3252  	return
  3253  }
  3254  func (c *cow) copyOnRewriteRefOfJtColumnDefinition(n *JtColumnDefinition, parent SQLNode) (out SQLNode, changed bool) {
  3255  	if n == nil || c.cursor.stop {
  3256  		return n, false
  3257  	}
  3258  	out = n
  3259  	if c.pre == nil || c.pre(n, parent) {
  3260  	}
  3261  	if c.post != nil {
  3262  		out, changed = c.postVisit(out, parent, changed)
  3263  	}
  3264  	return
  3265  }
  3266  func (c *cow) copyOnRewriteRefOfJtOnResponse(n *JtOnResponse, parent SQLNode) (out SQLNode, changed bool) {
  3267  	if n == nil || c.cursor.stop {
  3268  		return n, false
  3269  	}
  3270  	out = n
  3271  	if c.pre == nil || c.pre(n, parent) {
  3272  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3273  		if changedExpr {
  3274  			res := *n
  3275  			res.Expr, _ = _Expr.(Expr)
  3276  			out = &res
  3277  			if c.cloned != nil {
  3278  				c.cloned(n, out)
  3279  			}
  3280  			changed = true
  3281  		}
  3282  	}
  3283  	if c.post != nil {
  3284  		out, changed = c.postVisit(out, parent, changed)
  3285  	}
  3286  	return
  3287  }
  3288  func (c *cow) copyOnRewriteRefOfKeyState(n *KeyState, parent SQLNode) (out SQLNode, changed bool) {
  3289  	if n == nil || c.cursor.stop {
  3290  		return n, false
  3291  	}
  3292  	out = n
  3293  	if c.pre == nil || c.pre(n, parent) {
  3294  	}
  3295  	if c.post != nil {
  3296  		out, changed = c.postVisit(out, parent, changed)
  3297  	}
  3298  	return
  3299  }
  3300  func (c *cow) copyOnRewriteRefOfLagLeadExpr(n *LagLeadExpr, parent SQLNode) (out SQLNode, changed bool) {
  3301  	if n == nil || c.cursor.stop {
  3302  		return n, false
  3303  	}
  3304  	out = n
  3305  	if c.pre == nil || c.pre(n, parent) {
  3306  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3307  		_N, changedN := c.copyOnRewriteExpr(n.N, n)
  3308  		_Default, changedDefault := c.copyOnRewriteExpr(n.Default, n)
  3309  		_OverClause, changedOverClause := c.copyOnRewriteRefOfOverClause(n.OverClause, n)
  3310  		_NullTreatmentClause, changedNullTreatmentClause := c.copyOnRewriteRefOfNullTreatmentClause(n.NullTreatmentClause, n)
  3311  		if changedExpr || changedN || changedDefault || changedOverClause || changedNullTreatmentClause {
  3312  			res := *n
  3313  			res.Expr, _ = _Expr.(Expr)
  3314  			res.N, _ = _N.(Expr)
  3315  			res.Default, _ = _Default.(Expr)
  3316  			res.OverClause, _ = _OverClause.(*OverClause)
  3317  			res.NullTreatmentClause, _ = _NullTreatmentClause.(*NullTreatmentClause)
  3318  			out = &res
  3319  			if c.cloned != nil {
  3320  				c.cloned(n, out)
  3321  			}
  3322  			changed = true
  3323  		}
  3324  	}
  3325  	if c.post != nil {
  3326  		out, changed = c.postVisit(out, parent, changed)
  3327  	}
  3328  	return
  3329  }
  3330  func (c *cow) copyOnRewriteRefOfLimit(n *Limit, parent SQLNode) (out SQLNode, changed bool) {
  3331  	if n == nil || c.cursor.stop {
  3332  		return n, false
  3333  	}
  3334  	out = n
  3335  	if c.pre == nil || c.pre(n, parent) {
  3336  		_Offset, changedOffset := c.copyOnRewriteExpr(n.Offset, n)
  3337  		_Rowcount, changedRowcount := c.copyOnRewriteExpr(n.Rowcount, n)
  3338  		if changedOffset || changedRowcount {
  3339  			res := *n
  3340  			res.Offset, _ = _Offset.(Expr)
  3341  			res.Rowcount, _ = _Rowcount.(Expr)
  3342  			out = &res
  3343  			if c.cloned != nil {
  3344  				c.cloned(n, out)
  3345  			}
  3346  			changed = true
  3347  		}
  3348  	}
  3349  	if c.post != nil {
  3350  		out, changed = c.postVisit(out, parent, changed)
  3351  	}
  3352  	return
  3353  }
  3354  func (c *cow) copyOnRewriteRefOfLineStringExpr(n *LineStringExpr, parent SQLNode) (out SQLNode, changed bool) {
  3355  	if n == nil || c.cursor.stop {
  3356  		return n, false
  3357  	}
  3358  	out = n
  3359  	if c.pre == nil || c.pre(n, parent) {
  3360  		_PointParams, changedPointParams := c.copyOnRewriteExprs(n.PointParams, n)
  3361  		if changedPointParams {
  3362  			res := *n
  3363  			res.PointParams, _ = _PointParams.(Exprs)
  3364  			out = &res
  3365  			if c.cloned != nil {
  3366  				c.cloned(n, out)
  3367  			}
  3368  			changed = true
  3369  		}
  3370  	}
  3371  	if c.post != nil {
  3372  		out, changed = c.postVisit(out, parent, changed)
  3373  	}
  3374  	return
  3375  }
  3376  func (c *cow) copyOnRewriteRefOfLiteral(n *Literal, parent SQLNode) (out SQLNode, changed bool) {
  3377  	if n == nil || c.cursor.stop {
  3378  		return n, false
  3379  	}
  3380  	out = n
  3381  	if c.pre == nil || c.pre(n, parent) {
  3382  	}
  3383  	if c.post != nil {
  3384  		out, changed = c.postVisit(out, parent, changed)
  3385  	}
  3386  	return
  3387  }
  3388  func (c *cow) copyOnRewriteRefOfLoad(n *Load, parent SQLNode) (out SQLNode, changed bool) {
  3389  	if n == nil || c.cursor.stop {
  3390  		return n, false
  3391  	}
  3392  	out = n
  3393  	if c.pre == nil || c.pre(n, parent) {
  3394  	}
  3395  	if c.post != nil {
  3396  		out, changed = c.postVisit(out, parent, changed)
  3397  	}
  3398  	return
  3399  }
  3400  func (c *cow) copyOnRewriteRefOfLocateExpr(n *LocateExpr, parent SQLNode) (out SQLNode, changed bool) {
  3401  	if n == nil || c.cursor.stop {
  3402  		return n, false
  3403  	}
  3404  	out = n
  3405  	if c.pre == nil || c.pre(n, parent) {
  3406  		_SubStr, changedSubStr := c.copyOnRewriteExpr(n.SubStr, n)
  3407  		_Str, changedStr := c.copyOnRewriteExpr(n.Str, n)
  3408  		_Pos, changedPos := c.copyOnRewriteExpr(n.Pos, n)
  3409  		if changedSubStr || changedStr || changedPos {
  3410  			res := *n
  3411  			res.SubStr, _ = _SubStr.(Expr)
  3412  			res.Str, _ = _Str.(Expr)
  3413  			res.Pos, _ = _Pos.(Expr)
  3414  			out = &res
  3415  			if c.cloned != nil {
  3416  				c.cloned(n, out)
  3417  			}
  3418  			changed = true
  3419  		}
  3420  	}
  3421  	if c.post != nil {
  3422  		out, changed = c.postVisit(out, parent, changed)
  3423  	}
  3424  	return
  3425  }
  3426  func (c *cow) copyOnRewriteRefOfLockOption(n *LockOption, parent SQLNode) (out SQLNode, changed bool) {
  3427  	if n == nil || c.cursor.stop {
  3428  		return n, false
  3429  	}
  3430  	out = n
  3431  	if c.pre == nil || c.pre(n, parent) {
  3432  	}
  3433  	if c.post != nil {
  3434  		out, changed = c.postVisit(out, parent, changed)
  3435  	}
  3436  	return
  3437  }
  3438  func (c *cow) copyOnRewriteRefOfLockTables(n *LockTables, parent SQLNode) (out SQLNode, changed bool) {
  3439  	if n == nil || c.cursor.stop {
  3440  		return n, false
  3441  	}
  3442  	out = n
  3443  	if c.pre == nil || c.pre(n, parent) {
  3444  	}
  3445  	if c.post != nil {
  3446  		out, changed = c.postVisit(out, parent, changed)
  3447  	}
  3448  	return
  3449  }
  3450  func (c *cow) copyOnRewriteRefOfLockingFunc(n *LockingFunc, parent SQLNode) (out SQLNode, changed bool) {
  3451  	if n == nil || c.cursor.stop {
  3452  		return n, false
  3453  	}
  3454  	out = n
  3455  	if c.pre == nil || c.pre(n, parent) {
  3456  		_Name, changedName := c.copyOnRewriteExpr(n.Name, n)
  3457  		_Timeout, changedTimeout := c.copyOnRewriteExpr(n.Timeout, n)
  3458  		if changedName || changedTimeout {
  3459  			res := *n
  3460  			res.Name, _ = _Name.(Expr)
  3461  			res.Timeout, _ = _Timeout.(Expr)
  3462  			out = &res
  3463  			if c.cloned != nil {
  3464  				c.cloned(n, out)
  3465  			}
  3466  			changed = true
  3467  		}
  3468  	}
  3469  	if c.post != nil {
  3470  		out, changed = c.postVisit(out, parent, changed)
  3471  	}
  3472  	return
  3473  }
  3474  func (c *cow) copyOnRewriteRefOfMatchExpr(n *MatchExpr, parent SQLNode) (out SQLNode, changed bool) {
  3475  	if n == nil || c.cursor.stop {
  3476  		return n, false
  3477  	}
  3478  	out = n
  3479  	if c.pre == nil || c.pre(n, parent) {
  3480  		var changedColumns bool
  3481  		_Columns := make([]*ColName, len(n.Columns))
  3482  		for x, el := range n.Columns {
  3483  			this, changed := c.copyOnRewriteRefOfColName(el, n)
  3484  			_Columns[x] = this.(*ColName)
  3485  			if changed {
  3486  				changedColumns = true
  3487  			}
  3488  		}
  3489  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3490  		if changedColumns || changedExpr {
  3491  			res := *n
  3492  			res.Columns = _Columns
  3493  			res.Expr, _ = _Expr.(Expr)
  3494  			out = &res
  3495  			if c.cloned != nil {
  3496  				c.cloned(n, out)
  3497  			}
  3498  			changed = true
  3499  		}
  3500  	}
  3501  	if c.post != nil {
  3502  		out, changed = c.postVisit(out, parent, changed)
  3503  	}
  3504  	return
  3505  }
  3506  func (c *cow) copyOnRewriteRefOfMax(n *Max, parent SQLNode) (out SQLNode, changed bool) {
  3507  	if n == nil || c.cursor.stop {
  3508  		return n, false
  3509  	}
  3510  	out = n
  3511  	if c.pre == nil || c.pre(n, parent) {
  3512  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  3513  		if changedArg {
  3514  			res := *n
  3515  			res.Arg, _ = _Arg.(Expr)
  3516  			out = &res
  3517  			if c.cloned != nil {
  3518  				c.cloned(n, out)
  3519  			}
  3520  			changed = true
  3521  		}
  3522  	}
  3523  	if c.post != nil {
  3524  		out, changed = c.postVisit(out, parent, changed)
  3525  	}
  3526  	return
  3527  }
  3528  func (c *cow) copyOnRewriteRefOfMemberOfExpr(n *MemberOfExpr, parent SQLNode) (out SQLNode, changed bool) {
  3529  	if n == nil || c.cursor.stop {
  3530  		return n, false
  3531  	}
  3532  	out = n
  3533  	if c.pre == nil || c.pre(n, parent) {
  3534  		_Value, changedValue := c.copyOnRewriteExpr(n.Value, n)
  3535  		_JSONArr, changedJSONArr := c.copyOnRewriteExpr(n.JSONArr, n)
  3536  		if changedValue || changedJSONArr {
  3537  			res := *n
  3538  			res.Value, _ = _Value.(Expr)
  3539  			res.JSONArr, _ = _JSONArr.(Expr)
  3540  			out = &res
  3541  			if c.cloned != nil {
  3542  				c.cloned(n, out)
  3543  			}
  3544  			changed = true
  3545  		}
  3546  	}
  3547  	if c.post != nil {
  3548  		out, changed = c.postVisit(out, parent, changed)
  3549  	}
  3550  	return
  3551  }
  3552  func (c *cow) copyOnRewriteRefOfMin(n *Min, parent SQLNode) (out SQLNode, changed bool) {
  3553  	if n == nil || c.cursor.stop {
  3554  		return n, false
  3555  	}
  3556  	out = n
  3557  	if c.pre == nil || c.pre(n, parent) {
  3558  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  3559  		if changedArg {
  3560  			res := *n
  3561  			res.Arg, _ = _Arg.(Expr)
  3562  			out = &res
  3563  			if c.cloned != nil {
  3564  				c.cloned(n, out)
  3565  			}
  3566  			changed = true
  3567  		}
  3568  	}
  3569  	if c.post != nil {
  3570  		out, changed = c.postVisit(out, parent, changed)
  3571  	}
  3572  	return
  3573  }
  3574  func (c *cow) copyOnRewriteRefOfModifyColumn(n *ModifyColumn, parent SQLNode) (out SQLNode, changed bool) {
  3575  	if n == nil || c.cursor.stop {
  3576  		return n, false
  3577  	}
  3578  	out = n
  3579  	if c.pre == nil || c.pre(n, parent) {
  3580  		_NewColDefinition, changedNewColDefinition := c.copyOnRewriteRefOfColumnDefinition(n.NewColDefinition, n)
  3581  		_After, changedAfter := c.copyOnRewriteRefOfColName(n.After, n)
  3582  		if changedNewColDefinition || changedAfter {
  3583  			res := *n
  3584  			res.NewColDefinition, _ = _NewColDefinition.(*ColumnDefinition)
  3585  			res.After, _ = _After.(*ColName)
  3586  			out = &res
  3587  			if c.cloned != nil {
  3588  				c.cloned(n, out)
  3589  			}
  3590  			changed = true
  3591  		}
  3592  	}
  3593  	if c.post != nil {
  3594  		out, changed = c.postVisit(out, parent, changed)
  3595  	}
  3596  	return
  3597  }
  3598  func (c *cow) copyOnRewriteRefOfNTHValueExpr(n *NTHValueExpr, parent SQLNode) (out SQLNode, changed bool) {
  3599  	if n == nil || c.cursor.stop {
  3600  		return n, false
  3601  	}
  3602  	out = n
  3603  	if c.pre == nil || c.pre(n, parent) {
  3604  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3605  		_N, changedN := c.copyOnRewriteExpr(n.N, n)
  3606  		_OverClause, changedOverClause := c.copyOnRewriteRefOfOverClause(n.OverClause, n)
  3607  		_FromFirstLastClause, changedFromFirstLastClause := c.copyOnRewriteRefOfFromFirstLastClause(n.FromFirstLastClause, n)
  3608  		_NullTreatmentClause, changedNullTreatmentClause := c.copyOnRewriteRefOfNullTreatmentClause(n.NullTreatmentClause, n)
  3609  		if changedExpr || changedN || changedOverClause || changedFromFirstLastClause || changedNullTreatmentClause {
  3610  			res := *n
  3611  			res.Expr, _ = _Expr.(Expr)
  3612  			res.N, _ = _N.(Expr)
  3613  			res.OverClause, _ = _OverClause.(*OverClause)
  3614  			res.FromFirstLastClause, _ = _FromFirstLastClause.(*FromFirstLastClause)
  3615  			res.NullTreatmentClause, _ = _NullTreatmentClause.(*NullTreatmentClause)
  3616  			out = &res
  3617  			if c.cloned != nil {
  3618  				c.cloned(n, out)
  3619  			}
  3620  			changed = true
  3621  		}
  3622  	}
  3623  	if c.post != nil {
  3624  		out, changed = c.postVisit(out, parent, changed)
  3625  	}
  3626  	return
  3627  }
  3628  func (c *cow) copyOnRewriteRefOfNamedWindow(n *NamedWindow, parent SQLNode) (out SQLNode, changed bool) {
  3629  	if n == nil || c.cursor.stop {
  3630  		return n, false
  3631  	}
  3632  	out = n
  3633  	if c.pre == nil || c.pre(n, parent) {
  3634  		_Windows, changedWindows := c.copyOnRewriteWindowDefinitions(n.Windows, n)
  3635  		if changedWindows {
  3636  			res := *n
  3637  			res.Windows, _ = _Windows.(WindowDefinitions)
  3638  			out = &res
  3639  			if c.cloned != nil {
  3640  				c.cloned(n, out)
  3641  			}
  3642  			changed = true
  3643  		}
  3644  	}
  3645  	if c.post != nil {
  3646  		out, changed = c.postVisit(out, parent, changed)
  3647  	}
  3648  	return
  3649  }
  3650  func (c *cow) copyOnRewriteNamedWindows(n NamedWindows, parent SQLNode) (out SQLNode, changed bool) {
  3651  	if n == nil || c.cursor.stop {
  3652  		return n, false
  3653  	}
  3654  	out = n
  3655  	if c.pre == nil || c.pre(n, parent) {
  3656  		res := make(NamedWindows, len(n))
  3657  		for x, el := range n {
  3658  			this, change := c.copyOnRewriteRefOfNamedWindow(el, n)
  3659  			res[x] = this.(*NamedWindow)
  3660  			if change {
  3661  				changed = true
  3662  			}
  3663  		}
  3664  		if changed {
  3665  			out = res
  3666  		}
  3667  	}
  3668  	if c.post != nil {
  3669  		out, changed = c.postVisit(out, parent, changed)
  3670  	}
  3671  	return
  3672  }
  3673  func (c *cow) copyOnRewriteRefOfNextval(n *Nextval, parent SQLNode) (out SQLNode, changed bool) {
  3674  	if n == nil || c.cursor.stop {
  3675  		return n, false
  3676  	}
  3677  	out = n
  3678  	if c.pre == nil || c.pre(n, parent) {
  3679  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3680  		if changedExpr {
  3681  			res := *n
  3682  			res.Expr, _ = _Expr.(Expr)
  3683  			out = &res
  3684  			if c.cloned != nil {
  3685  				c.cloned(n, out)
  3686  			}
  3687  			changed = true
  3688  		}
  3689  	}
  3690  	if c.post != nil {
  3691  		out, changed = c.postVisit(out, parent, changed)
  3692  	}
  3693  	return
  3694  }
  3695  func (c *cow) copyOnRewriteRefOfNotExpr(n *NotExpr, parent SQLNode) (out SQLNode, changed bool) {
  3696  	if n == nil || c.cursor.stop {
  3697  		return n, false
  3698  	}
  3699  	out = n
  3700  	if c.pre == nil || c.pre(n, parent) {
  3701  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3702  		if changedExpr {
  3703  			res := *n
  3704  			res.Expr, _ = _Expr.(Expr)
  3705  			out = &res
  3706  			if c.cloned != nil {
  3707  				c.cloned(n, out)
  3708  			}
  3709  			changed = true
  3710  		}
  3711  	}
  3712  	if c.post != nil {
  3713  		out, changed = c.postVisit(out, parent, changed)
  3714  	}
  3715  	return
  3716  }
  3717  func (c *cow) copyOnRewriteRefOfNtileExpr(n *NtileExpr, parent SQLNode) (out SQLNode, changed bool) {
  3718  	if n == nil || c.cursor.stop {
  3719  		return n, false
  3720  	}
  3721  	out = n
  3722  	if c.pre == nil || c.pre(n, parent) {
  3723  		_N, changedN := c.copyOnRewriteExpr(n.N, n)
  3724  		_OverClause, changedOverClause := c.copyOnRewriteRefOfOverClause(n.OverClause, n)
  3725  		if changedN || changedOverClause {
  3726  			res := *n
  3727  			res.N, _ = _N.(Expr)
  3728  			res.OverClause, _ = _OverClause.(*OverClause)
  3729  			out = &res
  3730  			if c.cloned != nil {
  3731  				c.cloned(n, out)
  3732  			}
  3733  			changed = true
  3734  		}
  3735  	}
  3736  	if c.post != nil {
  3737  		out, changed = c.postVisit(out, parent, changed)
  3738  	}
  3739  	return
  3740  }
  3741  func (c *cow) copyOnRewriteRefOfNullTreatmentClause(n *NullTreatmentClause, parent SQLNode) (out SQLNode, changed bool) {
  3742  	if n == nil || c.cursor.stop {
  3743  		return n, false
  3744  	}
  3745  	out = n
  3746  	if c.pre == nil || c.pre(n, parent) {
  3747  	}
  3748  	if c.post != nil {
  3749  		out, changed = c.postVisit(out, parent, changed)
  3750  	}
  3751  	return
  3752  }
  3753  func (c *cow) copyOnRewriteRefOfNullVal(n *NullVal, parent SQLNode) (out SQLNode, changed bool) {
  3754  	if n == nil || c.cursor.stop {
  3755  		return n, false
  3756  	}
  3757  	out = n
  3758  	if c.pre == nil || c.pre(n, parent) {
  3759  	}
  3760  	if c.post != nil {
  3761  		out, changed = c.postVisit(out, parent, changed)
  3762  	}
  3763  	return
  3764  }
  3765  func (c *cow) copyOnRewriteRefOfOffset(n *Offset, parent SQLNode) (out SQLNode, changed bool) {
  3766  	if n == nil || c.cursor.stop {
  3767  		return n, false
  3768  	}
  3769  	out = n
  3770  	if c.pre == nil || c.pre(n, parent) {
  3771  	}
  3772  	if c.post != nil {
  3773  		out, changed = c.postVisit(out, parent, changed)
  3774  	}
  3775  	return
  3776  }
  3777  func (c *cow) copyOnRewriteOnDup(n OnDup, parent SQLNode) (out SQLNode, changed bool) {
  3778  	if n == nil || c.cursor.stop {
  3779  		return n, false
  3780  	}
  3781  	out = n
  3782  	if c.pre == nil || c.pre(n, parent) {
  3783  		res := make(OnDup, len(n))
  3784  		for x, el := range n {
  3785  			this, change := c.copyOnRewriteRefOfUpdateExpr(el, n)
  3786  			res[x] = this.(*UpdateExpr)
  3787  			if change {
  3788  				changed = true
  3789  			}
  3790  		}
  3791  		if changed {
  3792  			out = res
  3793  		}
  3794  	}
  3795  	if c.post != nil {
  3796  		out, changed = c.postVisit(out, parent, changed)
  3797  	}
  3798  	return
  3799  }
  3800  func (c *cow) copyOnRewriteRefOfOptLike(n *OptLike, parent SQLNode) (out SQLNode, changed bool) {
  3801  	if n == nil || c.cursor.stop {
  3802  		return n, false
  3803  	}
  3804  	out = n
  3805  	if c.pre == nil || c.pre(n, parent) {
  3806  		_LikeTable, changedLikeTable := c.copyOnRewriteTableName(n.LikeTable, n)
  3807  		if changedLikeTable {
  3808  			res := *n
  3809  			res.LikeTable, _ = _LikeTable.(TableName)
  3810  			out = &res
  3811  			if c.cloned != nil {
  3812  				c.cloned(n, out)
  3813  			}
  3814  			changed = true
  3815  		}
  3816  	}
  3817  	if c.post != nil {
  3818  		out, changed = c.postVisit(out, parent, changed)
  3819  	}
  3820  	return
  3821  }
  3822  func (c *cow) copyOnRewriteRefOfOrExpr(n *OrExpr, parent SQLNode) (out SQLNode, changed bool) {
  3823  	if n == nil || c.cursor.stop {
  3824  		return n, false
  3825  	}
  3826  	out = n
  3827  	if c.pre == nil || c.pre(n, parent) {
  3828  		_Left, changedLeft := c.copyOnRewriteExpr(n.Left, n)
  3829  		_Right, changedRight := c.copyOnRewriteExpr(n.Right, n)
  3830  		if changedLeft || changedRight {
  3831  			res := *n
  3832  			res.Left, _ = _Left.(Expr)
  3833  			res.Right, _ = _Right.(Expr)
  3834  			out = &res
  3835  			if c.cloned != nil {
  3836  				c.cloned(n, out)
  3837  			}
  3838  			changed = true
  3839  		}
  3840  	}
  3841  	if c.post != nil {
  3842  		out, changed = c.postVisit(out, parent, changed)
  3843  	}
  3844  	return
  3845  }
  3846  func (c *cow) copyOnRewriteRefOfOrder(n *Order, parent SQLNode) (out SQLNode, changed bool) {
  3847  	if n == nil || c.cursor.stop {
  3848  		return n, false
  3849  	}
  3850  	out = n
  3851  	if c.pre == nil || c.pre(n, parent) {
  3852  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  3853  		if changedExpr {
  3854  			res := *n
  3855  			res.Expr, _ = _Expr.(Expr)
  3856  			out = &res
  3857  			if c.cloned != nil {
  3858  				c.cloned(n, out)
  3859  			}
  3860  			changed = true
  3861  		}
  3862  	}
  3863  	if c.post != nil {
  3864  		out, changed = c.postVisit(out, parent, changed)
  3865  	}
  3866  	return
  3867  }
  3868  func (c *cow) copyOnRewriteOrderBy(n OrderBy, parent SQLNode) (out SQLNode, changed bool) {
  3869  	if n == nil || c.cursor.stop {
  3870  		return n, false
  3871  	}
  3872  	out = n
  3873  	if c.pre == nil || c.pre(n, parent) {
  3874  		res := make(OrderBy, len(n))
  3875  		for x, el := range n {
  3876  			this, change := c.copyOnRewriteRefOfOrder(el, n)
  3877  			res[x] = this.(*Order)
  3878  			if change {
  3879  				changed = true
  3880  			}
  3881  		}
  3882  		if changed {
  3883  			out = res
  3884  		}
  3885  	}
  3886  	if c.post != nil {
  3887  		out, changed = c.postVisit(out, parent, changed)
  3888  	}
  3889  	return
  3890  }
  3891  func (c *cow) copyOnRewriteRefOfOrderByOption(n *OrderByOption, parent SQLNode) (out SQLNode, changed bool) {
  3892  	if n == nil || c.cursor.stop {
  3893  		return n, false
  3894  	}
  3895  	out = n
  3896  	if c.pre == nil || c.pre(n, parent) {
  3897  		_Cols, changedCols := c.copyOnRewriteColumns(n.Cols, n)
  3898  		if changedCols {
  3899  			res := *n
  3900  			res.Cols, _ = _Cols.(Columns)
  3901  			out = &res
  3902  			if c.cloned != nil {
  3903  				c.cloned(n, out)
  3904  			}
  3905  			changed = true
  3906  		}
  3907  	}
  3908  	if c.post != nil {
  3909  		out, changed = c.postVisit(out, parent, changed)
  3910  	}
  3911  	return
  3912  }
  3913  func (c *cow) copyOnRewriteRefOfOtherAdmin(n *OtherAdmin, parent SQLNode) (out SQLNode, changed bool) {
  3914  	if n == nil || c.cursor.stop {
  3915  		return n, false
  3916  	}
  3917  	out = n
  3918  	if c.pre == nil || c.pre(n, parent) {
  3919  	}
  3920  	if c.post != nil {
  3921  		out, changed = c.postVisit(out, parent, changed)
  3922  	}
  3923  	return
  3924  }
  3925  func (c *cow) copyOnRewriteRefOfOtherRead(n *OtherRead, parent SQLNode) (out SQLNode, changed bool) {
  3926  	if n == nil || c.cursor.stop {
  3927  		return n, false
  3928  	}
  3929  	out = n
  3930  	if c.pre == nil || c.pre(n, parent) {
  3931  	}
  3932  	if c.post != nil {
  3933  		out, changed = c.postVisit(out, parent, changed)
  3934  	}
  3935  	return
  3936  }
  3937  func (c *cow) copyOnRewriteRefOfOverClause(n *OverClause, parent SQLNode) (out SQLNode, changed bool) {
  3938  	if n == nil || c.cursor.stop {
  3939  		return n, false
  3940  	}
  3941  	out = n
  3942  	if c.pre == nil || c.pre(n, parent) {
  3943  		_WindowName, changedWindowName := c.copyOnRewriteIdentifierCI(n.WindowName, n)
  3944  		_WindowSpec, changedWindowSpec := c.copyOnRewriteRefOfWindowSpecification(n.WindowSpec, n)
  3945  		if changedWindowName || changedWindowSpec {
  3946  			res := *n
  3947  			res.WindowName, _ = _WindowName.(IdentifierCI)
  3948  			res.WindowSpec, _ = _WindowSpec.(*WindowSpecification)
  3949  			out = &res
  3950  			if c.cloned != nil {
  3951  				c.cloned(n, out)
  3952  			}
  3953  			changed = true
  3954  		}
  3955  	}
  3956  	if c.post != nil {
  3957  		out, changed = c.postVisit(out, parent, changed)
  3958  	}
  3959  	return
  3960  }
  3961  func (c *cow) copyOnRewriteRefOfParenTableExpr(n *ParenTableExpr, parent SQLNode) (out SQLNode, changed bool) {
  3962  	if n == nil || c.cursor.stop {
  3963  		return n, false
  3964  	}
  3965  	out = n
  3966  	if c.pre == nil || c.pre(n, parent) {
  3967  		_Exprs, changedExprs := c.copyOnRewriteTableExprs(n.Exprs, n)
  3968  		if changedExprs {
  3969  			res := *n
  3970  			res.Exprs, _ = _Exprs.(TableExprs)
  3971  			out = &res
  3972  			if c.cloned != nil {
  3973  				c.cloned(n, out)
  3974  			}
  3975  			changed = true
  3976  		}
  3977  	}
  3978  	if c.post != nil {
  3979  		out, changed = c.postVisit(out, parent, changed)
  3980  	}
  3981  	return
  3982  }
  3983  func (c *cow) copyOnRewriteRefOfParsedComments(n *ParsedComments, parent SQLNode) (out SQLNode, changed bool) {
  3984  	if n == nil || c.cursor.stop {
  3985  		return n, false
  3986  	}
  3987  	out = n
  3988  	if c.pre == nil || c.pre(n, parent) {
  3989  	}
  3990  	if c.post != nil {
  3991  		out, changed = c.postVisit(out, parent, changed)
  3992  	}
  3993  	return
  3994  }
  3995  func (c *cow) copyOnRewriteRefOfPartitionDefinition(n *PartitionDefinition, parent SQLNode) (out SQLNode, changed bool) {
  3996  	if n == nil || c.cursor.stop {
  3997  		return n, false
  3998  	}
  3999  	out = n
  4000  	if c.pre == nil || c.pre(n, parent) {
  4001  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  4002  		_Options, changedOptions := c.copyOnRewriteRefOfPartitionDefinitionOptions(n.Options, n)
  4003  		if changedName || changedOptions {
  4004  			res := *n
  4005  			res.Name, _ = _Name.(IdentifierCI)
  4006  			res.Options, _ = _Options.(*PartitionDefinitionOptions)
  4007  			out = &res
  4008  			if c.cloned != nil {
  4009  				c.cloned(n, out)
  4010  			}
  4011  			changed = true
  4012  		}
  4013  	}
  4014  	if c.post != nil {
  4015  		out, changed = c.postVisit(out, parent, changed)
  4016  	}
  4017  	return
  4018  }
  4019  func (c *cow) copyOnRewriteRefOfPartitionDefinitionOptions(n *PartitionDefinitionOptions, parent SQLNode) (out SQLNode, changed bool) {
  4020  	if n == nil || c.cursor.stop {
  4021  		return n, false
  4022  	}
  4023  	out = n
  4024  	if c.pre == nil || c.pre(n, parent) {
  4025  		_ValueRange, changedValueRange := c.copyOnRewriteRefOfPartitionValueRange(n.ValueRange, n)
  4026  		_Comment, changedComment := c.copyOnRewriteRefOfLiteral(n.Comment, n)
  4027  		_Engine, changedEngine := c.copyOnRewriteRefOfPartitionEngine(n.Engine, n)
  4028  		_DataDirectory, changedDataDirectory := c.copyOnRewriteRefOfLiteral(n.DataDirectory, n)
  4029  		_IndexDirectory, changedIndexDirectory := c.copyOnRewriteRefOfLiteral(n.IndexDirectory, n)
  4030  		_SubPartitionDefinitions, changedSubPartitionDefinitions := c.copyOnRewriteSubPartitionDefinitions(n.SubPartitionDefinitions, n)
  4031  		if changedValueRange || changedComment || changedEngine || changedDataDirectory || changedIndexDirectory || changedSubPartitionDefinitions {
  4032  			res := *n
  4033  			res.ValueRange, _ = _ValueRange.(*PartitionValueRange)
  4034  			res.Comment, _ = _Comment.(*Literal)
  4035  			res.Engine, _ = _Engine.(*PartitionEngine)
  4036  			res.DataDirectory, _ = _DataDirectory.(*Literal)
  4037  			res.IndexDirectory, _ = _IndexDirectory.(*Literal)
  4038  			res.SubPartitionDefinitions, _ = _SubPartitionDefinitions.(SubPartitionDefinitions)
  4039  			out = &res
  4040  			if c.cloned != nil {
  4041  				c.cloned(n, out)
  4042  			}
  4043  			changed = true
  4044  		}
  4045  	}
  4046  	if c.post != nil {
  4047  		out, changed = c.postVisit(out, parent, changed)
  4048  	}
  4049  	return
  4050  }
  4051  func (c *cow) copyOnRewriteRefOfPartitionEngine(n *PartitionEngine, parent SQLNode) (out SQLNode, changed bool) {
  4052  	if n == nil || c.cursor.stop {
  4053  		return n, false
  4054  	}
  4055  	out = n
  4056  	if c.pre == nil || c.pre(n, parent) {
  4057  	}
  4058  	if c.post != nil {
  4059  		out, changed = c.postVisit(out, parent, changed)
  4060  	}
  4061  	return
  4062  }
  4063  func (c *cow) copyOnRewriteRefOfPartitionOption(n *PartitionOption, parent SQLNode) (out SQLNode, changed bool) {
  4064  	if n == nil || c.cursor.stop {
  4065  		return n, false
  4066  	}
  4067  	out = n
  4068  	if c.pre == nil || c.pre(n, parent) {
  4069  		_ColList, changedColList := c.copyOnRewriteColumns(n.ColList, n)
  4070  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  4071  		_SubPartition, changedSubPartition := c.copyOnRewriteRefOfSubPartition(n.SubPartition, n)
  4072  		var changedDefinitions bool
  4073  		_Definitions := make([]*PartitionDefinition, len(n.Definitions))
  4074  		for x, el := range n.Definitions {
  4075  			this, changed := c.copyOnRewriteRefOfPartitionDefinition(el, n)
  4076  			_Definitions[x] = this.(*PartitionDefinition)
  4077  			if changed {
  4078  				changedDefinitions = true
  4079  			}
  4080  		}
  4081  		if changedColList || changedExpr || changedSubPartition || changedDefinitions {
  4082  			res := *n
  4083  			res.ColList, _ = _ColList.(Columns)
  4084  			res.Expr, _ = _Expr.(Expr)
  4085  			res.SubPartition, _ = _SubPartition.(*SubPartition)
  4086  			res.Definitions = _Definitions
  4087  			out = &res
  4088  			if c.cloned != nil {
  4089  				c.cloned(n, out)
  4090  			}
  4091  			changed = true
  4092  		}
  4093  	}
  4094  	if c.post != nil {
  4095  		out, changed = c.postVisit(out, parent, changed)
  4096  	}
  4097  	return
  4098  }
  4099  func (c *cow) copyOnRewriteRefOfPartitionSpec(n *PartitionSpec, parent SQLNode) (out SQLNode, changed bool) {
  4100  	if n == nil || c.cursor.stop {
  4101  		return n, false
  4102  	}
  4103  	out = n
  4104  	if c.pre == nil || c.pre(n, parent) {
  4105  		_Names, changedNames := c.copyOnRewritePartitions(n.Names, n)
  4106  		_Number, changedNumber := c.copyOnRewriteRefOfLiteral(n.Number, n)
  4107  		_TableName, changedTableName := c.copyOnRewriteTableName(n.TableName, n)
  4108  		var changedDefinitions bool
  4109  		_Definitions := make([]*PartitionDefinition, len(n.Definitions))
  4110  		for x, el := range n.Definitions {
  4111  			this, changed := c.copyOnRewriteRefOfPartitionDefinition(el, n)
  4112  			_Definitions[x] = this.(*PartitionDefinition)
  4113  			if changed {
  4114  				changedDefinitions = true
  4115  			}
  4116  		}
  4117  		if changedNames || changedNumber || changedTableName || changedDefinitions {
  4118  			res := *n
  4119  			res.Names, _ = _Names.(Partitions)
  4120  			res.Number, _ = _Number.(*Literal)
  4121  			res.TableName, _ = _TableName.(TableName)
  4122  			res.Definitions = _Definitions
  4123  			out = &res
  4124  			if c.cloned != nil {
  4125  				c.cloned(n, out)
  4126  			}
  4127  			changed = true
  4128  		}
  4129  	}
  4130  	if c.post != nil {
  4131  		out, changed = c.postVisit(out, parent, changed)
  4132  	}
  4133  	return
  4134  }
  4135  func (c *cow) copyOnRewriteRefOfPartitionValueRange(n *PartitionValueRange, parent SQLNode) (out SQLNode, changed bool) {
  4136  	if n == nil || c.cursor.stop {
  4137  		return n, false
  4138  	}
  4139  	out = n
  4140  	if c.pre == nil || c.pre(n, parent) {
  4141  		_Range, changedRange := c.copyOnRewriteValTuple(n.Range, n)
  4142  		if changedRange {
  4143  			res := *n
  4144  			res.Range, _ = _Range.(ValTuple)
  4145  			out = &res
  4146  			if c.cloned != nil {
  4147  				c.cloned(n, out)
  4148  			}
  4149  			changed = true
  4150  		}
  4151  	}
  4152  	if c.post != nil {
  4153  		out, changed = c.postVisit(out, parent, changed)
  4154  	}
  4155  	return
  4156  }
  4157  func (c *cow) copyOnRewritePartitions(n Partitions, parent SQLNode) (out SQLNode, changed bool) {
  4158  	if n == nil || c.cursor.stop {
  4159  		return n, false
  4160  	}
  4161  	out = n
  4162  	if c.pre == nil || c.pre(n, parent) {
  4163  		res := make(Partitions, len(n))
  4164  		for x, el := range n {
  4165  			this, change := c.copyOnRewriteIdentifierCI(el, n)
  4166  			res[x] = this.(IdentifierCI)
  4167  			if change {
  4168  				changed = true
  4169  			}
  4170  		}
  4171  		if changed {
  4172  			out = res
  4173  		}
  4174  	}
  4175  	if c.post != nil {
  4176  		out, changed = c.postVisit(out, parent, changed)
  4177  	}
  4178  	return
  4179  }
  4180  func (c *cow) copyOnRewriteRefOfPerformanceSchemaFuncExpr(n *PerformanceSchemaFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  4181  	if n == nil || c.cursor.stop {
  4182  		return n, false
  4183  	}
  4184  	out = n
  4185  	if c.pre == nil || c.pre(n, parent) {
  4186  		_Argument, changedArgument := c.copyOnRewriteExpr(n.Argument, n)
  4187  		if changedArgument {
  4188  			res := *n
  4189  			res.Argument, _ = _Argument.(Expr)
  4190  			out = &res
  4191  			if c.cloned != nil {
  4192  				c.cloned(n, out)
  4193  			}
  4194  			changed = true
  4195  		}
  4196  	}
  4197  	if c.post != nil {
  4198  		out, changed = c.postVisit(out, parent, changed)
  4199  	}
  4200  	return
  4201  }
  4202  func (c *cow) copyOnRewriteRefOfPointExpr(n *PointExpr, parent SQLNode) (out SQLNode, changed bool) {
  4203  	if n == nil || c.cursor.stop {
  4204  		return n, false
  4205  	}
  4206  	out = n
  4207  	if c.pre == nil || c.pre(n, parent) {
  4208  		_XCordinate, changedXCordinate := c.copyOnRewriteExpr(n.XCordinate, n)
  4209  		_YCordinate, changedYCordinate := c.copyOnRewriteExpr(n.YCordinate, n)
  4210  		if changedXCordinate || changedYCordinate {
  4211  			res := *n
  4212  			res.XCordinate, _ = _XCordinate.(Expr)
  4213  			res.YCordinate, _ = _YCordinate.(Expr)
  4214  			out = &res
  4215  			if c.cloned != nil {
  4216  				c.cloned(n, out)
  4217  			}
  4218  			changed = true
  4219  		}
  4220  	}
  4221  	if c.post != nil {
  4222  		out, changed = c.postVisit(out, parent, changed)
  4223  	}
  4224  	return
  4225  }
  4226  func (c *cow) copyOnRewriteRefOfPrepareStmt(n *PrepareStmt, parent SQLNode) (out SQLNode, changed bool) {
  4227  	if n == nil || c.cursor.stop {
  4228  		return n, false
  4229  	}
  4230  	out = n
  4231  	if c.pre == nil || c.pre(n, parent) {
  4232  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  4233  		_Statement, changedStatement := c.copyOnRewriteExpr(n.Statement, n)
  4234  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  4235  		if changedName || changedStatement || changedComments {
  4236  			res := *n
  4237  			res.Name, _ = _Name.(IdentifierCI)
  4238  			res.Statement, _ = _Statement.(Expr)
  4239  			res.Comments, _ = _Comments.(*ParsedComments)
  4240  			out = &res
  4241  			if c.cloned != nil {
  4242  				c.cloned(n, out)
  4243  			}
  4244  			changed = true
  4245  		}
  4246  	}
  4247  	if c.post != nil {
  4248  		out, changed = c.postVisit(out, parent, changed)
  4249  	}
  4250  	return
  4251  }
  4252  func (c *cow) copyOnRewriteRefOfReferenceDefinition(n *ReferenceDefinition, parent SQLNode) (out SQLNode, changed bool) {
  4253  	if n == nil || c.cursor.stop {
  4254  		return n, false
  4255  	}
  4256  	out = n
  4257  	if c.pre == nil || c.pre(n, parent) {
  4258  		_ReferencedTable, changedReferencedTable := c.copyOnRewriteTableName(n.ReferencedTable, n)
  4259  		_ReferencedColumns, changedReferencedColumns := c.copyOnRewriteColumns(n.ReferencedColumns, n)
  4260  		_Match, changedMatch := c.copyOnRewriteMatchAction(n.Match, n)
  4261  		_OnDelete, changedOnDelete := c.copyOnRewriteReferenceAction(n.OnDelete, n)
  4262  		_OnUpdate, changedOnUpdate := c.copyOnRewriteReferenceAction(n.OnUpdate, n)
  4263  		if changedReferencedTable || changedReferencedColumns || changedMatch || changedOnDelete || changedOnUpdate {
  4264  			res := *n
  4265  			res.ReferencedTable, _ = _ReferencedTable.(TableName)
  4266  			res.ReferencedColumns, _ = _ReferencedColumns.(Columns)
  4267  			res.Match, _ = _Match.(MatchAction)
  4268  			res.OnDelete, _ = _OnDelete.(ReferenceAction)
  4269  			res.OnUpdate, _ = _OnUpdate.(ReferenceAction)
  4270  			out = &res
  4271  			if c.cloned != nil {
  4272  				c.cloned(n, out)
  4273  			}
  4274  			changed = true
  4275  		}
  4276  	}
  4277  	if c.post != nil {
  4278  		out, changed = c.postVisit(out, parent, changed)
  4279  	}
  4280  	return
  4281  }
  4282  func (c *cow) copyOnRewriteRefOfRegexpInstrExpr(n *RegexpInstrExpr, parent SQLNode) (out SQLNode, changed bool) {
  4283  	if n == nil || c.cursor.stop {
  4284  		return n, false
  4285  	}
  4286  	out = n
  4287  	if c.pre == nil || c.pre(n, parent) {
  4288  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  4289  		_Pattern, changedPattern := c.copyOnRewriteExpr(n.Pattern, n)
  4290  		_Position, changedPosition := c.copyOnRewriteExpr(n.Position, n)
  4291  		_Occurrence, changedOccurrence := c.copyOnRewriteExpr(n.Occurrence, n)
  4292  		_ReturnOption, changedReturnOption := c.copyOnRewriteExpr(n.ReturnOption, n)
  4293  		_MatchType, changedMatchType := c.copyOnRewriteExpr(n.MatchType, n)
  4294  		if changedExpr || changedPattern || changedPosition || changedOccurrence || changedReturnOption || changedMatchType {
  4295  			res := *n
  4296  			res.Expr, _ = _Expr.(Expr)
  4297  			res.Pattern, _ = _Pattern.(Expr)
  4298  			res.Position, _ = _Position.(Expr)
  4299  			res.Occurrence, _ = _Occurrence.(Expr)
  4300  			res.ReturnOption, _ = _ReturnOption.(Expr)
  4301  			res.MatchType, _ = _MatchType.(Expr)
  4302  			out = &res
  4303  			if c.cloned != nil {
  4304  				c.cloned(n, out)
  4305  			}
  4306  			changed = true
  4307  		}
  4308  	}
  4309  	if c.post != nil {
  4310  		out, changed = c.postVisit(out, parent, changed)
  4311  	}
  4312  	return
  4313  }
  4314  func (c *cow) copyOnRewriteRefOfRegexpLikeExpr(n *RegexpLikeExpr, parent SQLNode) (out SQLNode, changed bool) {
  4315  	if n == nil || c.cursor.stop {
  4316  		return n, false
  4317  	}
  4318  	out = n
  4319  	if c.pre == nil || c.pre(n, parent) {
  4320  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  4321  		_Pattern, changedPattern := c.copyOnRewriteExpr(n.Pattern, n)
  4322  		_MatchType, changedMatchType := c.copyOnRewriteExpr(n.MatchType, n)
  4323  		if changedExpr || changedPattern || changedMatchType {
  4324  			res := *n
  4325  			res.Expr, _ = _Expr.(Expr)
  4326  			res.Pattern, _ = _Pattern.(Expr)
  4327  			res.MatchType, _ = _MatchType.(Expr)
  4328  			out = &res
  4329  			if c.cloned != nil {
  4330  				c.cloned(n, out)
  4331  			}
  4332  			changed = true
  4333  		}
  4334  	}
  4335  	if c.post != nil {
  4336  		out, changed = c.postVisit(out, parent, changed)
  4337  	}
  4338  	return
  4339  }
  4340  func (c *cow) copyOnRewriteRefOfRegexpReplaceExpr(n *RegexpReplaceExpr, parent SQLNode) (out SQLNode, changed bool) {
  4341  	if n == nil || c.cursor.stop {
  4342  		return n, false
  4343  	}
  4344  	out = n
  4345  	if c.pre == nil || c.pre(n, parent) {
  4346  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  4347  		_Pattern, changedPattern := c.copyOnRewriteExpr(n.Pattern, n)
  4348  		_Repl, changedRepl := c.copyOnRewriteExpr(n.Repl, n)
  4349  		_Occurrence, changedOccurrence := c.copyOnRewriteExpr(n.Occurrence, n)
  4350  		_Position, changedPosition := c.copyOnRewriteExpr(n.Position, n)
  4351  		_MatchType, changedMatchType := c.copyOnRewriteExpr(n.MatchType, n)
  4352  		if changedExpr || changedPattern || changedRepl || changedOccurrence || changedPosition || changedMatchType {
  4353  			res := *n
  4354  			res.Expr, _ = _Expr.(Expr)
  4355  			res.Pattern, _ = _Pattern.(Expr)
  4356  			res.Repl, _ = _Repl.(Expr)
  4357  			res.Occurrence, _ = _Occurrence.(Expr)
  4358  			res.Position, _ = _Position.(Expr)
  4359  			res.MatchType, _ = _MatchType.(Expr)
  4360  			out = &res
  4361  			if c.cloned != nil {
  4362  				c.cloned(n, out)
  4363  			}
  4364  			changed = true
  4365  		}
  4366  	}
  4367  	if c.post != nil {
  4368  		out, changed = c.postVisit(out, parent, changed)
  4369  	}
  4370  	return
  4371  }
  4372  func (c *cow) copyOnRewriteRefOfRegexpSubstrExpr(n *RegexpSubstrExpr, parent SQLNode) (out SQLNode, changed bool) {
  4373  	if n == nil || c.cursor.stop {
  4374  		return n, false
  4375  	}
  4376  	out = n
  4377  	if c.pre == nil || c.pre(n, parent) {
  4378  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  4379  		_Pattern, changedPattern := c.copyOnRewriteExpr(n.Pattern, n)
  4380  		_Occurrence, changedOccurrence := c.copyOnRewriteExpr(n.Occurrence, n)
  4381  		_Position, changedPosition := c.copyOnRewriteExpr(n.Position, n)
  4382  		_MatchType, changedMatchType := c.copyOnRewriteExpr(n.MatchType, n)
  4383  		if changedExpr || changedPattern || changedOccurrence || changedPosition || changedMatchType {
  4384  			res := *n
  4385  			res.Expr, _ = _Expr.(Expr)
  4386  			res.Pattern, _ = _Pattern.(Expr)
  4387  			res.Occurrence, _ = _Occurrence.(Expr)
  4388  			res.Position, _ = _Position.(Expr)
  4389  			res.MatchType, _ = _MatchType.(Expr)
  4390  			out = &res
  4391  			if c.cloned != nil {
  4392  				c.cloned(n, out)
  4393  			}
  4394  			changed = true
  4395  		}
  4396  	}
  4397  	if c.post != nil {
  4398  		out, changed = c.postVisit(out, parent, changed)
  4399  	}
  4400  	return
  4401  }
  4402  func (c *cow) copyOnRewriteRefOfRelease(n *Release, parent SQLNode) (out SQLNode, changed bool) {
  4403  	if n == nil || c.cursor.stop {
  4404  		return n, false
  4405  	}
  4406  	out = n
  4407  	if c.pre == nil || c.pre(n, parent) {
  4408  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  4409  		if changedName {
  4410  			res := *n
  4411  			res.Name, _ = _Name.(IdentifierCI)
  4412  			out = &res
  4413  			if c.cloned != nil {
  4414  				c.cloned(n, out)
  4415  			}
  4416  			changed = true
  4417  		}
  4418  	}
  4419  	if c.post != nil {
  4420  		out, changed = c.postVisit(out, parent, changed)
  4421  	}
  4422  	return
  4423  }
  4424  func (c *cow) copyOnRewriteRefOfRenameColumn(n *RenameColumn, parent SQLNode) (out SQLNode, changed bool) {
  4425  	if n == nil || c.cursor.stop {
  4426  		return n, false
  4427  	}
  4428  	out = n
  4429  	if c.pre == nil || c.pre(n, parent) {
  4430  		_OldName, changedOldName := c.copyOnRewriteRefOfColName(n.OldName, n)
  4431  		_NewName, changedNewName := c.copyOnRewriteRefOfColName(n.NewName, n)
  4432  		if changedOldName || changedNewName {
  4433  			res := *n
  4434  			res.OldName, _ = _OldName.(*ColName)
  4435  			res.NewName, _ = _NewName.(*ColName)
  4436  			out = &res
  4437  			if c.cloned != nil {
  4438  				c.cloned(n, out)
  4439  			}
  4440  			changed = true
  4441  		}
  4442  	}
  4443  	if c.post != nil {
  4444  		out, changed = c.postVisit(out, parent, changed)
  4445  	}
  4446  	return
  4447  }
  4448  func (c *cow) copyOnRewriteRefOfRenameIndex(n *RenameIndex, parent SQLNode) (out SQLNode, changed bool) {
  4449  	if n == nil || c.cursor.stop {
  4450  		return n, false
  4451  	}
  4452  	out = n
  4453  	if c.pre == nil || c.pre(n, parent) {
  4454  		_OldName, changedOldName := c.copyOnRewriteIdentifierCI(n.OldName, n)
  4455  		_NewName, changedNewName := c.copyOnRewriteIdentifierCI(n.NewName, n)
  4456  		if changedOldName || changedNewName {
  4457  			res := *n
  4458  			res.OldName, _ = _OldName.(IdentifierCI)
  4459  			res.NewName, _ = _NewName.(IdentifierCI)
  4460  			out = &res
  4461  			if c.cloned != nil {
  4462  				c.cloned(n, out)
  4463  			}
  4464  			changed = true
  4465  		}
  4466  	}
  4467  	if c.post != nil {
  4468  		out, changed = c.postVisit(out, parent, changed)
  4469  	}
  4470  	return
  4471  }
  4472  func (c *cow) copyOnRewriteRefOfRenameTable(n *RenameTable, parent SQLNode) (out SQLNode, changed bool) {
  4473  	if n == nil || c.cursor.stop {
  4474  		return n, false
  4475  	}
  4476  	out = n
  4477  	if c.pre == nil || c.pre(n, parent) {
  4478  	}
  4479  	if c.post != nil {
  4480  		out, changed = c.postVisit(out, parent, changed)
  4481  	}
  4482  	return
  4483  }
  4484  func (c *cow) copyOnRewriteRefOfRenameTableName(n *RenameTableName, parent SQLNode) (out SQLNode, changed bool) {
  4485  	if n == nil || c.cursor.stop {
  4486  		return n, false
  4487  	}
  4488  	out = n
  4489  	if c.pre == nil || c.pre(n, parent) {
  4490  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
  4491  		if changedTable {
  4492  			res := *n
  4493  			res.Table, _ = _Table.(TableName)
  4494  			out = &res
  4495  			if c.cloned != nil {
  4496  				c.cloned(n, out)
  4497  			}
  4498  			changed = true
  4499  		}
  4500  	}
  4501  	if c.post != nil {
  4502  		out, changed = c.postVisit(out, parent, changed)
  4503  	}
  4504  	return
  4505  }
  4506  func (c *cow) copyOnRewriteRefOfRevertMigration(n *RevertMigration, parent SQLNode) (out SQLNode, changed bool) {
  4507  	if n == nil || c.cursor.stop {
  4508  		return n, false
  4509  	}
  4510  	out = n
  4511  	if c.pre == nil || c.pre(n, parent) {
  4512  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  4513  		if changedComments {
  4514  			res := *n
  4515  			res.Comments, _ = _Comments.(*ParsedComments)
  4516  			out = &res
  4517  			if c.cloned != nil {
  4518  				c.cloned(n, out)
  4519  			}
  4520  			changed = true
  4521  		}
  4522  	}
  4523  	if c.post != nil {
  4524  		out, changed = c.postVisit(out, parent, changed)
  4525  	}
  4526  	return
  4527  }
  4528  func (c *cow) copyOnRewriteRefOfRollback(n *Rollback, parent SQLNode) (out SQLNode, changed bool) {
  4529  	if n == nil || c.cursor.stop {
  4530  		return n, false
  4531  	}
  4532  	out = n
  4533  	if c.pre == nil || c.pre(n, parent) {
  4534  	}
  4535  	if c.post != nil {
  4536  		out, changed = c.postVisit(out, parent, changed)
  4537  	}
  4538  	return
  4539  }
  4540  func (c *cow) copyOnRewriteRootNode(n RootNode, parent SQLNode) (out SQLNode, changed bool) {
  4541  	out = n
  4542  	if c.pre == nil || c.pre(n, parent) {
  4543  		_SQLNode, changedSQLNode := c.copyOnRewriteSQLNode(n.SQLNode, n)
  4544  		if changedSQLNode {
  4545  			res := n
  4546  			res.SQLNode, _ = _SQLNode.(SQLNode)
  4547  			out = &res
  4548  			if c.cloned != nil {
  4549  				c.cloned(n, out)
  4550  			}
  4551  			changed = true
  4552  		}
  4553  	}
  4554  	if c.post != nil {
  4555  		out, changed = c.postVisit(out, parent, changed)
  4556  	}
  4557  	return
  4558  }
  4559  func (c *cow) copyOnRewriteRefOfSRollback(n *SRollback, parent SQLNode) (out SQLNode, changed bool) {
  4560  	if n == nil || c.cursor.stop {
  4561  		return n, false
  4562  	}
  4563  	out = n
  4564  	if c.pre == nil || c.pre(n, parent) {
  4565  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  4566  		if changedName {
  4567  			res := *n
  4568  			res.Name, _ = _Name.(IdentifierCI)
  4569  			out = &res
  4570  			if c.cloned != nil {
  4571  				c.cloned(n, out)
  4572  			}
  4573  			changed = true
  4574  		}
  4575  	}
  4576  	if c.post != nil {
  4577  		out, changed = c.postVisit(out, parent, changed)
  4578  	}
  4579  	return
  4580  }
  4581  func (c *cow) copyOnRewriteRefOfSavepoint(n *Savepoint, parent SQLNode) (out SQLNode, changed bool) {
  4582  	if n == nil || c.cursor.stop {
  4583  		return n, false
  4584  	}
  4585  	out = n
  4586  	if c.pre == nil || c.pre(n, parent) {
  4587  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  4588  		if changedName {
  4589  			res := *n
  4590  			res.Name, _ = _Name.(IdentifierCI)
  4591  			out = &res
  4592  			if c.cloned != nil {
  4593  				c.cloned(n, out)
  4594  			}
  4595  			changed = true
  4596  		}
  4597  	}
  4598  	if c.post != nil {
  4599  		out, changed = c.postVisit(out, parent, changed)
  4600  	}
  4601  	return
  4602  }
  4603  func (c *cow) copyOnRewriteRefOfSelect(n *Select, parent SQLNode) (out SQLNode, changed bool) {
  4604  	if n == nil || c.cursor.stop {
  4605  		return n, false
  4606  	}
  4607  	out = n
  4608  	if c.pre == nil || c.pre(n, parent) {
  4609  		var changedFrom bool
  4610  		_From := make([]TableExpr, len(n.From))
  4611  		for x, el := range n.From {
  4612  			this, changed := c.copyOnRewriteTableExpr(el, n)
  4613  			_From[x] = this.(TableExpr)
  4614  			if changed {
  4615  				changedFrom = true
  4616  			}
  4617  		}
  4618  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  4619  		_SelectExprs, changedSelectExprs := c.copyOnRewriteSelectExprs(n.SelectExprs, n)
  4620  		_Where, changedWhere := c.copyOnRewriteRefOfWhere(n.Where, n)
  4621  		_With, changedWith := c.copyOnRewriteRefOfWith(n.With, n)
  4622  		_GroupBy, changedGroupBy := c.copyOnRewriteGroupBy(n.GroupBy, n)
  4623  		_Having, changedHaving := c.copyOnRewriteRefOfWhere(n.Having, n)
  4624  		_Windows, changedWindows := c.copyOnRewriteNamedWindows(n.Windows, n)
  4625  		_OrderBy, changedOrderBy := c.copyOnRewriteOrderBy(n.OrderBy, n)
  4626  		_Limit, changedLimit := c.copyOnRewriteRefOfLimit(n.Limit, n)
  4627  		_Into, changedInto := c.copyOnRewriteRefOfSelectInto(n.Into, n)
  4628  		if changedFrom || changedComments || changedSelectExprs || changedWhere || changedWith || changedGroupBy || changedHaving || changedWindows || changedOrderBy || changedLimit || changedInto {
  4629  			res := *n
  4630  			res.From = _From
  4631  			res.Comments, _ = _Comments.(*ParsedComments)
  4632  			res.SelectExprs, _ = _SelectExprs.(SelectExprs)
  4633  			res.Where, _ = _Where.(*Where)
  4634  			res.With, _ = _With.(*With)
  4635  			res.GroupBy, _ = _GroupBy.(GroupBy)
  4636  			res.Having, _ = _Having.(*Where)
  4637  			res.Windows, _ = _Windows.(NamedWindows)
  4638  			res.OrderBy, _ = _OrderBy.(OrderBy)
  4639  			res.Limit, _ = _Limit.(*Limit)
  4640  			res.Into, _ = _Into.(*SelectInto)
  4641  			out = &res
  4642  			if c.cloned != nil {
  4643  				c.cloned(n, out)
  4644  			}
  4645  			changed = true
  4646  		}
  4647  	}
  4648  	if c.post != nil {
  4649  		out, changed = c.postVisit(out, parent, changed)
  4650  	}
  4651  	return
  4652  }
  4653  func (c *cow) copyOnRewriteSelectExprs(n SelectExprs, parent SQLNode) (out SQLNode, changed bool) {
  4654  	if n == nil || c.cursor.stop {
  4655  		return n, false
  4656  	}
  4657  	out = n
  4658  	if c.pre == nil || c.pre(n, parent) {
  4659  		res := make(SelectExprs, len(n))
  4660  		for x, el := range n {
  4661  			this, change := c.copyOnRewriteSelectExpr(el, n)
  4662  			res[x] = this.(SelectExpr)
  4663  			if change {
  4664  				changed = true
  4665  			}
  4666  		}
  4667  		if changed {
  4668  			out = res
  4669  		}
  4670  	}
  4671  	if c.post != nil {
  4672  		out, changed = c.postVisit(out, parent, changed)
  4673  	}
  4674  	return
  4675  }
  4676  func (c *cow) copyOnRewriteRefOfSelectInto(n *SelectInto, parent SQLNode) (out SQLNode, changed bool) {
  4677  	if n == nil || c.cursor.stop {
  4678  		return n, false
  4679  	}
  4680  	out = n
  4681  	if c.pre == nil || c.pre(n, parent) {
  4682  	}
  4683  	if c.post != nil {
  4684  		out, changed = c.postVisit(out, parent, changed)
  4685  	}
  4686  	return
  4687  }
  4688  func (c *cow) copyOnRewriteRefOfSet(n *Set, parent SQLNode) (out SQLNode, changed bool) {
  4689  	if n == nil || c.cursor.stop {
  4690  		return n, false
  4691  	}
  4692  	out = n
  4693  	if c.pre == nil || c.pre(n, parent) {
  4694  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  4695  		_Exprs, changedExprs := c.copyOnRewriteSetExprs(n.Exprs, n)
  4696  		if changedComments || changedExprs {
  4697  			res := *n
  4698  			res.Comments, _ = _Comments.(*ParsedComments)
  4699  			res.Exprs, _ = _Exprs.(SetExprs)
  4700  			out = &res
  4701  			if c.cloned != nil {
  4702  				c.cloned(n, out)
  4703  			}
  4704  			changed = true
  4705  		}
  4706  	}
  4707  	if c.post != nil {
  4708  		out, changed = c.postVisit(out, parent, changed)
  4709  	}
  4710  	return
  4711  }
  4712  func (c *cow) copyOnRewriteRefOfSetExpr(n *SetExpr, parent SQLNode) (out SQLNode, changed bool) {
  4713  	if n == nil || c.cursor.stop {
  4714  		return n, false
  4715  	}
  4716  	out = n
  4717  	if c.pre == nil || c.pre(n, parent) {
  4718  		_Var, changedVar := c.copyOnRewriteRefOfVariable(n.Var, n)
  4719  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  4720  		if changedVar || changedExpr {
  4721  			res := *n
  4722  			res.Var, _ = _Var.(*Variable)
  4723  			res.Expr, _ = _Expr.(Expr)
  4724  			out = &res
  4725  			if c.cloned != nil {
  4726  				c.cloned(n, out)
  4727  			}
  4728  			changed = true
  4729  		}
  4730  	}
  4731  	if c.post != nil {
  4732  		out, changed = c.postVisit(out, parent, changed)
  4733  	}
  4734  	return
  4735  }
  4736  func (c *cow) copyOnRewriteSetExprs(n SetExprs, parent SQLNode) (out SQLNode, changed bool) {
  4737  	if n == nil || c.cursor.stop {
  4738  		return n, false
  4739  	}
  4740  	out = n
  4741  	if c.pre == nil || c.pre(n, parent) {
  4742  		res := make(SetExprs, len(n))
  4743  		for x, el := range n {
  4744  			this, change := c.copyOnRewriteRefOfSetExpr(el, n)
  4745  			res[x] = this.(*SetExpr)
  4746  			if change {
  4747  				changed = true
  4748  			}
  4749  		}
  4750  		if changed {
  4751  			out = res
  4752  		}
  4753  	}
  4754  	if c.post != nil {
  4755  		out, changed = c.postVisit(out, parent, changed)
  4756  	}
  4757  	return
  4758  }
  4759  func (c *cow) copyOnRewriteRefOfShow(n *Show, parent SQLNode) (out SQLNode, changed bool) {
  4760  	if n == nil || c.cursor.stop {
  4761  		return n, false
  4762  	}
  4763  	out = n
  4764  	if c.pre == nil || c.pre(n, parent) {
  4765  		_Internal, changedInternal := c.copyOnRewriteShowInternal(n.Internal, n)
  4766  		if changedInternal {
  4767  			res := *n
  4768  			res.Internal, _ = _Internal.(ShowInternal)
  4769  			out = &res
  4770  			if c.cloned != nil {
  4771  				c.cloned(n, out)
  4772  			}
  4773  			changed = true
  4774  		}
  4775  	}
  4776  	if c.post != nil {
  4777  		out, changed = c.postVisit(out, parent, changed)
  4778  	}
  4779  	return
  4780  }
  4781  func (c *cow) copyOnRewriteRefOfShowBasic(n *ShowBasic, parent SQLNode) (out SQLNode, changed bool) {
  4782  	if n == nil || c.cursor.stop {
  4783  		return n, false
  4784  	}
  4785  	out = n
  4786  	if c.pre == nil || c.pre(n, parent) {
  4787  		_Tbl, changedTbl := c.copyOnRewriteTableName(n.Tbl, n)
  4788  		_DbName, changedDbName := c.copyOnRewriteIdentifierCS(n.DbName, n)
  4789  		_Filter, changedFilter := c.copyOnRewriteRefOfShowFilter(n.Filter, n)
  4790  		if changedTbl || changedDbName || changedFilter {
  4791  			res := *n
  4792  			res.Tbl, _ = _Tbl.(TableName)
  4793  			res.DbName, _ = _DbName.(IdentifierCS)
  4794  			res.Filter, _ = _Filter.(*ShowFilter)
  4795  			out = &res
  4796  			if c.cloned != nil {
  4797  				c.cloned(n, out)
  4798  			}
  4799  			changed = true
  4800  		}
  4801  	}
  4802  	if c.post != nil {
  4803  		out, changed = c.postVisit(out, parent, changed)
  4804  	}
  4805  	return
  4806  }
  4807  func (c *cow) copyOnRewriteRefOfShowCreate(n *ShowCreate, parent SQLNode) (out SQLNode, changed bool) {
  4808  	if n == nil || c.cursor.stop {
  4809  		return n, false
  4810  	}
  4811  	out = n
  4812  	if c.pre == nil || c.pre(n, parent) {
  4813  		_Op, changedOp := c.copyOnRewriteTableName(n.Op, n)
  4814  		if changedOp {
  4815  			res := *n
  4816  			res.Op, _ = _Op.(TableName)
  4817  			out = &res
  4818  			if c.cloned != nil {
  4819  				c.cloned(n, out)
  4820  			}
  4821  			changed = true
  4822  		}
  4823  	}
  4824  	if c.post != nil {
  4825  		out, changed = c.postVisit(out, parent, changed)
  4826  	}
  4827  	return
  4828  }
  4829  func (c *cow) copyOnRewriteRefOfShowFilter(n *ShowFilter, parent SQLNode) (out SQLNode, changed bool) {
  4830  	if n == nil || c.cursor.stop {
  4831  		return n, false
  4832  	}
  4833  	out = n
  4834  	if c.pre == nil || c.pre(n, parent) {
  4835  		_Filter, changedFilter := c.copyOnRewriteExpr(n.Filter, n)
  4836  		if changedFilter {
  4837  			res := *n
  4838  			res.Filter, _ = _Filter.(Expr)
  4839  			out = &res
  4840  			if c.cloned != nil {
  4841  				c.cloned(n, out)
  4842  			}
  4843  			changed = true
  4844  		}
  4845  	}
  4846  	if c.post != nil {
  4847  		out, changed = c.postVisit(out, parent, changed)
  4848  	}
  4849  	return
  4850  }
  4851  func (c *cow) copyOnRewriteRefOfShowMigrationLogs(n *ShowMigrationLogs, parent SQLNode) (out SQLNode, changed bool) {
  4852  	if n == nil || c.cursor.stop {
  4853  		return n, false
  4854  	}
  4855  	out = n
  4856  	if c.pre == nil || c.pre(n, parent) {
  4857  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  4858  		if changedComments {
  4859  			res := *n
  4860  			res.Comments, _ = _Comments.(*ParsedComments)
  4861  			out = &res
  4862  			if c.cloned != nil {
  4863  				c.cloned(n, out)
  4864  			}
  4865  			changed = true
  4866  		}
  4867  	}
  4868  	if c.post != nil {
  4869  		out, changed = c.postVisit(out, parent, changed)
  4870  	}
  4871  	return
  4872  }
  4873  func (c *cow) copyOnRewriteRefOfShowOther(n *ShowOther, parent SQLNode) (out SQLNode, changed bool) {
  4874  	if n == nil || c.cursor.stop {
  4875  		return n, false
  4876  	}
  4877  	out = n
  4878  	if c.pre == nil || c.pre(n, parent) {
  4879  	}
  4880  	if c.post != nil {
  4881  		out, changed = c.postVisit(out, parent, changed)
  4882  	}
  4883  	return
  4884  }
  4885  func (c *cow) copyOnRewriteRefOfShowThrottledApps(n *ShowThrottledApps, parent SQLNode) (out SQLNode, changed bool) {
  4886  	if n == nil || c.cursor.stop {
  4887  		return n, false
  4888  	}
  4889  	out = n
  4890  	if c.pre == nil || c.pre(n, parent) {
  4891  	}
  4892  	if c.post != nil {
  4893  		out, changed = c.postVisit(out, parent, changed)
  4894  	}
  4895  	return
  4896  }
  4897  func (c *cow) copyOnRewriteRefOfShowThrottlerStatus(n *ShowThrottlerStatus, parent SQLNode) (out SQLNode, changed bool) {
  4898  	if n == nil || c.cursor.stop {
  4899  		return n, false
  4900  	}
  4901  	out = n
  4902  	if c.pre == nil || c.pre(n, parent) {
  4903  	}
  4904  	if c.post != nil {
  4905  		out, changed = c.postVisit(out, parent, changed)
  4906  	}
  4907  	return
  4908  }
  4909  func (c *cow) copyOnRewriteRefOfStarExpr(n *StarExpr, parent SQLNode) (out SQLNode, changed bool) {
  4910  	if n == nil || c.cursor.stop {
  4911  		return n, false
  4912  	}
  4913  	out = n
  4914  	if c.pre == nil || c.pre(n, parent) {
  4915  		_TableName, changedTableName := c.copyOnRewriteTableName(n.TableName, n)
  4916  		if changedTableName {
  4917  			res := *n
  4918  			res.TableName, _ = _TableName.(TableName)
  4919  			out = &res
  4920  			if c.cloned != nil {
  4921  				c.cloned(n, out)
  4922  			}
  4923  			changed = true
  4924  		}
  4925  	}
  4926  	if c.post != nil {
  4927  		out, changed = c.postVisit(out, parent, changed)
  4928  	}
  4929  	return
  4930  }
  4931  func (c *cow) copyOnRewriteRefOfStd(n *Std, parent SQLNode) (out SQLNode, changed bool) {
  4932  	if n == nil || c.cursor.stop {
  4933  		return n, false
  4934  	}
  4935  	out = n
  4936  	if c.pre == nil || c.pre(n, parent) {
  4937  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  4938  		if changedArg {
  4939  			res := *n
  4940  			res.Arg, _ = _Arg.(Expr)
  4941  			out = &res
  4942  			if c.cloned != nil {
  4943  				c.cloned(n, out)
  4944  			}
  4945  			changed = true
  4946  		}
  4947  	}
  4948  	if c.post != nil {
  4949  		out, changed = c.postVisit(out, parent, changed)
  4950  	}
  4951  	return
  4952  }
  4953  func (c *cow) copyOnRewriteRefOfStdDev(n *StdDev, parent SQLNode) (out SQLNode, changed bool) {
  4954  	if n == nil || c.cursor.stop {
  4955  		return n, false
  4956  	}
  4957  	out = n
  4958  	if c.pre == nil || c.pre(n, parent) {
  4959  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  4960  		if changedArg {
  4961  			res := *n
  4962  			res.Arg, _ = _Arg.(Expr)
  4963  			out = &res
  4964  			if c.cloned != nil {
  4965  				c.cloned(n, out)
  4966  			}
  4967  			changed = true
  4968  		}
  4969  	}
  4970  	if c.post != nil {
  4971  		out, changed = c.postVisit(out, parent, changed)
  4972  	}
  4973  	return
  4974  }
  4975  func (c *cow) copyOnRewriteRefOfStdPop(n *StdPop, parent SQLNode) (out SQLNode, changed bool) {
  4976  	if n == nil || c.cursor.stop {
  4977  		return n, false
  4978  	}
  4979  	out = n
  4980  	if c.pre == nil || c.pre(n, parent) {
  4981  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  4982  		if changedArg {
  4983  			res := *n
  4984  			res.Arg, _ = _Arg.(Expr)
  4985  			out = &res
  4986  			if c.cloned != nil {
  4987  				c.cloned(n, out)
  4988  			}
  4989  			changed = true
  4990  		}
  4991  	}
  4992  	if c.post != nil {
  4993  		out, changed = c.postVisit(out, parent, changed)
  4994  	}
  4995  	return
  4996  }
  4997  func (c *cow) copyOnRewriteRefOfStdSamp(n *StdSamp, parent SQLNode) (out SQLNode, changed bool) {
  4998  	if n == nil || c.cursor.stop {
  4999  		return n, false
  5000  	}
  5001  	out = n
  5002  	if c.pre == nil || c.pre(n, parent) {
  5003  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  5004  		if changedArg {
  5005  			res := *n
  5006  			res.Arg, _ = _Arg.(Expr)
  5007  			out = &res
  5008  			if c.cloned != nil {
  5009  				c.cloned(n, out)
  5010  			}
  5011  			changed = true
  5012  		}
  5013  	}
  5014  	if c.post != nil {
  5015  		out, changed = c.postVisit(out, parent, changed)
  5016  	}
  5017  	return
  5018  }
  5019  func (c *cow) copyOnRewriteRefOfStream(n *Stream, parent SQLNode) (out SQLNode, changed bool) {
  5020  	if n == nil || c.cursor.stop {
  5021  		return n, false
  5022  	}
  5023  	out = n
  5024  	if c.pre == nil || c.pre(n, parent) {
  5025  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  5026  		_SelectExpr, changedSelectExpr := c.copyOnRewriteSelectExpr(n.SelectExpr, n)
  5027  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
  5028  		if changedComments || changedSelectExpr || changedTable {
  5029  			res := *n
  5030  			res.Comments, _ = _Comments.(*ParsedComments)
  5031  			res.SelectExpr, _ = _SelectExpr.(SelectExpr)
  5032  			res.Table, _ = _Table.(TableName)
  5033  			out = &res
  5034  			if c.cloned != nil {
  5035  				c.cloned(n, out)
  5036  			}
  5037  			changed = true
  5038  		}
  5039  	}
  5040  	if c.post != nil {
  5041  		out, changed = c.postVisit(out, parent, changed)
  5042  	}
  5043  	return
  5044  }
  5045  func (c *cow) copyOnRewriteRefOfSubPartition(n *SubPartition, parent SQLNode) (out SQLNode, changed bool) {
  5046  	if n == nil || c.cursor.stop {
  5047  		return n, false
  5048  	}
  5049  	out = n
  5050  	if c.pre == nil || c.pre(n, parent) {
  5051  		_ColList, changedColList := c.copyOnRewriteColumns(n.ColList, n)
  5052  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  5053  		if changedColList || changedExpr {
  5054  			res := *n
  5055  			res.ColList, _ = _ColList.(Columns)
  5056  			res.Expr, _ = _Expr.(Expr)
  5057  			out = &res
  5058  			if c.cloned != nil {
  5059  				c.cloned(n, out)
  5060  			}
  5061  			changed = true
  5062  		}
  5063  	}
  5064  	if c.post != nil {
  5065  		out, changed = c.postVisit(out, parent, changed)
  5066  	}
  5067  	return
  5068  }
  5069  func (c *cow) copyOnRewriteRefOfSubPartitionDefinition(n *SubPartitionDefinition, parent SQLNode) (out SQLNode, changed bool) {
  5070  	if n == nil || c.cursor.stop {
  5071  		return n, false
  5072  	}
  5073  	out = n
  5074  	if c.pre == nil || c.pre(n, parent) {
  5075  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  5076  		_Options, changedOptions := c.copyOnRewriteRefOfSubPartitionDefinitionOptions(n.Options, n)
  5077  		if changedName || changedOptions {
  5078  			res := *n
  5079  			res.Name, _ = _Name.(IdentifierCI)
  5080  			res.Options, _ = _Options.(*SubPartitionDefinitionOptions)
  5081  			out = &res
  5082  			if c.cloned != nil {
  5083  				c.cloned(n, out)
  5084  			}
  5085  			changed = true
  5086  		}
  5087  	}
  5088  	if c.post != nil {
  5089  		out, changed = c.postVisit(out, parent, changed)
  5090  	}
  5091  	return
  5092  }
  5093  func (c *cow) copyOnRewriteRefOfSubPartitionDefinitionOptions(n *SubPartitionDefinitionOptions, parent SQLNode) (out SQLNode, changed bool) {
  5094  	if n == nil || c.cursor.stop {
  5095  		return n, false
  5096  	}
  5097  	out = n
  5098  	if c.pre == nil || c.pre(n, parent) {
  5099  		_Comment, changedComment := c.copyOnRewriteRefOfLiteral(n.Comment, n)
  5100  		_Engine, changedEngine := c.copyOnRewriteRefOfPartitionEngine(n.Engine, n)
  5101  		_DataDirectory, changedDataDirectory := c.copyOnRewriteRefOfLiteral(n.DataDirectory, n)
  5102  		_IndexDirectory, changedIndexDirectory := c.copyOnRewriteRefOfLiteral(n.IndexDirectory, n)
  5103  		if changedComment || changedEngine || changedDataDirectory || changedIndexDirectory {
  5104  			res := *n
  5105  			res.Comment, _ = _Comment.(*Literal)
  5106  			res.Engine, _ = _Engine.(*PartitionEngine)
  5107  			res.DataDirectory, _ = _DataDirectory.(*Literal)
  5108  			res.IndexDirectory, _ = _IndexDirectory.(*Literal)
  5109  			out = &res
  5110  			if c.cloned != nil {
  5111  				c.cloned(n, out)
  5112  			}
  5113  			changed = true
  5114  		}
  5115  	}
  5116  	if c.post != nil {
  5117  		out, changed = c.postVisit(out, parent, changed)
  5118  	}
  5119  	return
  5120  }
  5121  func (c *cow) copyOnRewriteSubPartitionDefinitions(n SubPartitionDefinitions, parent SQLNode) (out SQLNode, changed bool) {
  5122  	if n == nil || c.cursor.stop {
  5123  		return n, false
  5124  	}
  5125  	out = n
  5126  	if c.pre == nil || c.pre(n, parent) {
  5127  		res := make(SubPartitionDefinitions, len(n))
  5128  		for x, el := range n {
  5129  			this, change := c.copyOnRewriteRefOfSubPartitionDefinition(el, n)
  5130  			res[x] = this.(*SubPartitionDefinition)
  5131  			if change {
  5132  				changed = true
  5133  			}
  5134  		}
  5135  		if changed {
  5136  			out = res
  5137  		}
  5138  	}
  5139  	if c.post != nil {
  5140  		out, changed = c.postVisit(out, parent, changed)
  5141  	}
  5142  	return
  5143  }
  5144  func (c *cow) copyOnRewriteRefOfSubquery(n *Subquery, parent SQLNode) (out SQLNode, changed bool) {
  5145  	if n == nil || c.cursor.stop {
  5146  		return n, false
  5147  	}
  5148  	out = n
  5149  	if c.pre == nil || c.pre(n, parent) {
  5150  		_Select, changedSelect := c.copyOnRewriteSelectStatement(n.Select, n)
  5151  		if changedSelect {
  5152  			res := *n
  5153  			res.Select, _ = _Select.(SelectStatement)
  5154  			out = &res
  5155  			if c.cloned != nil {
  5156  				c.cloned(n, out)
  5157  			}
  5158  			changed = true
  5159  		}
  5160  	}
  5161  	if c.post != nil {
  5162  		out, changed = c.postVisit(out, parent, changed)
  5163  	}
  5164  	return
  5165  }
  5166  func (c *cow) copyOnRewriteRefOfSubstrExpr(n *SubstrExpr, parent SQLNode) (out SQLNode, changed bool) {
  5167  	if n == nil || c.cursor.stop {
  5168  		return n, false
  5169  	}
  5170  	out = n
  5171  	if c.pre == nil || c.pre(n, parent) {
  5172  		_Name, changedName := c.copyOnRewriteExpr(n.Name, n)
  5173  		_From, changedFrom := c.copyOnRewriteExpr(n.From, n)
  5174  		_To, changedTo := c.copyOnRewriteExpr(n.To, n)
  5175  		if changedName || changedFrom || changedTo {
  5176  			res := *n
  5177  			res.Name, _ = _Name.(Expr)
  5178  			res.From, _ = _From.(Expr)
  5179  			res.To, _ = _To.(Expr)
  5180  			out = &res
  5181  			if c.cloned != nil {
  5182  				c.cloned(n, out)
  5183  			}
  5184  			changed = true
  5185  		}
  5186  	}
  5187  	if c.post != nil {
  5188  		out, changed = c.postVisit(out, parent, changed)
  5189  	}
  5190  	return
  5191  }
  5192  func (c *cow) copyOnRewriteRefOfSum(n *Sum, parent SQLNode) (out SQLNode, changed bool) {
  5193  	if n == nil || c.cursor.stop {
  5194  		return n, false
  5195  	}
  5196  	out = n
  5197  	if c.pre == nil || c.pre(n, parent) {
  5198  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  5199  		if changedArg {
  5200  			res := *n
  5201  			res.Arg, _ = _Arg.(Expr)
  5202  			out = &res
  5203  			if c.cloned != nil {
  5204  				c.cloned(n, out)
  5205  			}
  5206  			changed = true
  5207  		}
  5208  	}
  5209  	if c.post != nil {
  5210  		out, changed = c.postVisit(out, parent, changed)
  5211  	}
  5212  	return
  5213  }
  5214  func (c *cow) copyOnRewriteTableExprs(n TableExprs, parent SQLNode) (out SQLNode, changed bool) {
  5215  	if n == nil || c.cursor.stop {
  5216  		return n, false
  5217  	}
  5218  	out = n
  5219  	if c.pre == nil || c.pre(n, parent) {
  5220  		res := make(TableExprs, len(n))
  5221  		for x, el := range n {
  5222  			this, change := c.copyOnRewriteTableExpr(el, n)
  5223  			res[x] = this.(TableExpr)
  5224  			if change {
  5225  				changed = true
  5226  			}
  5227  		}
  5228  		if changed {
  5229  			out = res
  5230  		}
  5231  	}
  5232  	if c.post != nil {
  5233  		out, changed = c.postVisit(out, parent, changed)
  5234  	}
  5235  	return
  5236  }
  5237  func (c *cow) copyOnRewriteTableName(n TableName, parent SQLNode) (out SQLNode, changed bool) {
  5238  	out = n
  5239  	if c.pre == nil || c.pre(n, parent) {
  5240  		_Name, changedName := c.copyOnRewriteIdentifierCS(n.Name, n)
  5241  		_Qualifier, changedQualifier := c.copyOnRewriteIdentifierCS(n.Qualifier, n)
  5242  		if changedName || changedQualifier {
  5243  			res := n
  5244  			res.Name, _ = _Name.(IdentifierCS)
  5245  			res.Qualifier, _ = _Qualifier.(IdentifierCS)
  5246  			out = &res
  5247  			if c.cloned != nil {
  5248  				c.cloned(n, out)
  5249  			}
  5250  			changed = true
  5251  		}
  5252  	}
  5253  	if c.post != nil {
  5254  		out, changed = c.postVisit(out, parent, changed)
  5255  	}
  5256  	return
  5257  }
  5258  func (c *cow) copyOnRewriteTableNames(n TableNames, parent SQLNode) (out SQLNode, changed bool) {
  5259  	if n == nil || c.cursor.stop {
  5260  		return n, false
  5261  	}
  5262  	out = n
  5263  	if c.pre == nil || c.pre(n, parent) {
  5264  		res := make(TableNames, len(n))
  5265  		for x, el := range n {
  5266  			this, change := c.copyOnRewriteTableName(el, n)
  5267  			res[x] = this.(TableName)
  5268  			if change {
  5269  				changed = true
  5270  			}
  5271  		}
  5272  		if changed {
  5273  			out = res
  5274  		}
  5275  	}
  5276  	if c.post != nil {
  5277  		out, changed = c.postVisit(out, parent, changed)
  5278  	}
  5279  	return
  5280  }
  5281  func (c *cow) copyOnRewriteTableOptions(n TableOptions, parent SQLNode) (out SQLNode, changed bool) {
  5282  	if n == nil || c.cursor.stop {
  5283  		return n, false
  5284  	}
  5285  	out = n
  5286  	if c.pre != nil {
  5287  		c.pre(n, parent)
  5288  	}
  5289  	if c.post != nil {
  5290  		out, changed = c.postVisit(out, parent, changed)
  5291  	}
  5292  	return
  5293  }
  5294  func (c *cow) copyOnRewriteRefOfTableSpec(n *TableSpec, parent SQLNode) (out SQLNode, changed bool) {
  5295  	if n == nil || c.cursor.stop {
  5296  		return n, false
  5297  	}
  5298  	out = n
  5299  	if c.pre == nil || c.pre(n, parent) {
  5300  		var changedColumns bool
  5301  		_Columns := make([]*ColumnDefinition, len(n.Columns))
  5302  		for x, el := range n.Columns {
  5303  			this, changed := c.copyOnRewriteRefOfColumnDefinition(el, n)
  5304  			_Columns[x] = this.(*ColumnDefinition)
  5305  			if changed {
  5306  				changedColumns = true
  5307  			}
  5308  		}
  5309  		var changedIndexes bool
  5310  		_Indexes := make([]*IndexDefinition, len(n.Indexes))
  5311  		for x, el := range n.Indexes {
  5312  			this, changed := c.copyOnRewriteRefOfIndexDefinition(el, n)
  5313  			_Indexes[x] = this.(*IndexDefinition)
  5314  			if changed {
  5315  				changedIndexes = true
  5316  			}
  5317  		}
  5318  		var changedConstraints bool
  5319  		_Constraints := make([]*ConstraintDefinition, len(n.Constraints))
  5320  		for x, el := range n.Constraints {
  5321  			this, changed := c.copyOnRewriteRefOfConstraintDefinition(el, n)
  5322  			_Constraints[x] = this.(*ConstraintDefinition)
  5323  			if changed {
  5324  				changedConstraints = true
  5325  			}
  5326  		}
  5327  		_Options, changedOptions := c.copyOnRewriteTableOptions(n.Options, n)
  5328  		_PartitionOption, changedPartitionOption := c.copyOnRewriteRefOfPartitionOption(n.PartitionOption, n)
  5329  		if changedColumns || changedIndexes || changedConstraints || changedOptions || changedPartitionOption {
  5330  			res := *n
  5331  			res.Columns = _Columns
  5332  			res.Indexes = _Indexes
  5333  			res.Constraints = _Constraints
  5334  			res.Options, _ = _Options.(TableOptions)
  5335  			res.PartitionOption, _ = _PartitionOption.(*PartitionOption)
  5336  			out = &res
  5337  			if c.cloned != nil {
  5338  				c.cloned(n, out)
  5339  			}
  5340  			changed = true
  5341  		}
  5342  	}
  5343  	if c.post != nil {
  5344  		out, changed = c.postVisit(out, parent, changed)
  5345  	}
  5346  	return
  5347  }
  5348  func (c *cow) copyOnRewriteRefOfTablespaceOperation(n *TablespaceOperation, parent SQLNode) (out SQLNode, changed bool) {
  5349  	if n == nil || c.cursor.stop {
  5350  		return n, false
  5351  	}
  5352  	out = n
  5353  	if c.pre == nil || c.pre(n, parent) {
  5354  	}
  5355  	if c.post != nil {
  5356  		out, changed = c.postVisit(out, parent, changed)
  5357  	}
  5358  	return
  5359  }
  5360  func (c *cow) copyOnRewriteRefOfTimestampFuncExpr(n *TimestampFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  5361  	if n == nil || c.cursor.stop {
  5362  		return n, false
  5363  	}
  5364  	out = n
  5365  	if c.pre == nil || c.pre(n, parent) {
  5366  		_Expr1, changedExpr1 := c.copyOnRewriteExpr(n.Expr1, n)
  5367  		_Expr2, changedExpr2 := c.copyOnRewriteExpr(n.Expr2, n)
  5368  		if changedExpr1 || changedExpr2 {
  5369  			res := *n
  5370  			res.Expr1, _ = _Expr1.(Expr)
  5371  			res.Expr2, _ = _Expr2.(Expr)
  5372  			out = &res
  5373  			if c.cloned != nil {
  5374  				c.cloned(n, out)
  5375  			}
  5376  			changed = true
  5377  		}
  5378  	}
  5379  	if c.post != nil {
  5380  		out, changed = c.postVisit(out, parent, changed)
  5381  	}
  5382  	return
  5383  }
  5384  func (c *cow) copyOnRewriteRefOfTrimFuncExpr(n *TrimFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  5385  	if n == nil || c.cursor.stop {
  5386  		return n, false
  5387  	}
  5388  	out = n
  5389  	if c.pre == nil || c.pre(n, parent) {
  5390  		_TrimArg, changedTrimArg := c.copyOnRewriteExpr(n.TrimArg, n)
  5391  		_StringArg, changedStringArg := c.copyOnRewriteExpr(n.StringArg, n)
  5392  		if changedTrimArg || changedStringArg {
  5393  			res := *n
  5394  			res.TrimArg, _ = _TrimArg.(Expr)
  5395  			res.StringArg, _ = _StringArg.(Expr)
  5396  			out = &res
  5397  			if c.cloned != nil {
  5398  				c.cloned(n, out)
  5399  			}
  5400  			changed = true
  5401  		}
  5402  	}
  5403  	if c.post != nil {
  5404  		out, changed = c.postVisit(out, parent, changed)
  5405  	}
  5406  	return
  5407  }
  5408  func (c *cow) copyOnRewriteRefOfTruncateTable(n *TruncateTable, parent SQLNode) (out SQLNode, changed bool) {
  5409  	if n == nil || c.cursor.stop {
  5410  		return n, false
  5411  	}
  5412  	out = n
  5413  	if c.pre == nil || c.pre(n, parent) {
  5414  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
  5415  		if changedTable {
  5416  			res := *n
  5417  			res.Table, _ = _Table.(TableName)
  5418  			out = &res
  5419  			if c.cloned != nil {
  5420  				c.cloned(n, out)
  5421  			}
  5422  			changed = true
  5423  		}
  5424  	}
  5425  	if c.post != nil {
  5426  		out, changed = c.postVisit(out, parent, changed)
  5427  	}
  5428  	return
  5429  }
  5430  func (c *cow) copyOnRewriteRefOfUnaryExpr(n *UnaryExpr, parent SQLNode) (out SQLNode, changed bool) {
  5431  	if n == nil || c.cursor.stop {
  5432  		return n, false
  5433  	}
  5434  	out = n
  5435  	if c.pre == nil || c.pre(n, parent) {
  5436  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  5437  		if changedExpr {
  5438  			res := *n
  5439  			res.Expr, _ = _Expr.(Expr)
  5440  			out = &res
  5441  			if c.cloned != nil {
  5442  				c.cloned(n, out)
  5443  			}
  5444  			changed = true
  5445  		}
  5446  	}
  5447  	if c.post != nil {
  5448  		out, changed = c.postVisit(out, parent, changed)
  5449  	}
  5450  	return
  5451  }
  5452  func (c *cow) copyOnRewriteRefOfUnion(n *Union, parent SQLNode) (out SQLNode, changed bool) {
  5453  	if n == nil || c.cursor.stop {
  5454  		return n, false
  5455  	}
  5456  	out = n
  5457  	if c.pre == nil || c.pre(n, parent) {
  5458  		_Left, changedLeft := c.copyOnRewriteSelectStatement(n.Left, n)
  5459  		_Right, changedRight := c.copyOnRewriteSelectStatement(n.Right, n)
  5460  		_OrderBy, changedOrderBy := c.copyOnRewriteOrderBy(n.OrderBy, n)
  5461  		_With, changedWith := c.copyOnRewriteRefOfWith(n.With, n)
  5462  		_Limit, changedLimit := c.copyOnRewriteRefOfLimit(n.Limit, n)
  5463  		_Into, changedInto := c.copyOnRewriteRefOfSelectInto(n.Into, n)
  5464  		if changedLeft || changedRight || changedOrderBy || changedWith || changedLimit || changedInto {
  5465  			res := *n
  5466  			res.Left, _ = _Left.(SelectStatement)
  5467  			res.Right, _ = _Right.(SelectStatement)
  5468  			res.OrderBy, _ = _OrderBy.(OrderBy)
  5469  			res.With, _ = _With.(*With)
  5470  			res.Limit, _ = _Limit.(*Limit)
  5471  			res.Into, _ = _Into.(*SelectInto)
  5472  			out = &res
  5473  			if c.cloned != nil {
  5474  				c.cloned(n, out)
  5475  			}
  5476  			changed = true
  5477  		}
  5478  	}
  5479  	if c.post != nil {
  5480  		out, changed = c.postVisit(out, parent, changed)
  5481  	}
  5482  	return
  5483  }
  5484  func (c *cow) copyOnRewriteRefOfUnlockTables(n *UnlockTables, parent SQLNode) (out SQLNode, changed bool) {
  5485  	if n == nil || c.cursor.stop {
  5486  		return n, false
  5487  	}
  5488  	out = n
  5489  	if c.pre == nil || c.pre(n, parent) {
  5490  	}
  5491  	if c.post != nil {
  5492  		out, changed = c.postVisit(out, parent, changed)
  5493  	}
  5494  	return
  5495  }
  5496  func (c *cow) copyOnRewriteRefOfUpdate(n *Update, parent SQLNode) (out SQLNode, changed bool) {
  5497  	if n == nil || c.cursor.stop {
  5498  		return n, false
  5499  	}
  5500  	out = n
  5501  	if c.pre == nil || c.pre(n, parent) {
  5502  		_With, changedWith := c.copyOnRewriteRefOfWith(n.With, n)
  5503  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  5504  		_TableExprs, changedTableExprs := c.copyOnRewriteTableExprs(n.TableExprs, n)
  5505  		_Exprs, changedExprs := c.copyOnRewriteUpdateExprs(n.Exprs, n)
  5506  		_Where, changedWhere := c.copyOnRewriteRefOfWhere(n.Where, n)
  5507  		_OrderBy, changedOrderBy := c.copyOnRewriteOrderBy(n.OrderBy, n)
  5508  		_Limit, changedLimit := c.copyOnRewriteRefOfLimit(n.Limit, n)
  5509  		if changedWith || changedComments || changedTableExprs || changedExprs || changedWhere || changedOrderBy || changedLimit {
  5510  			res := *n
  5511  			res.With, _ = _With.(*With)
  5512  			res.Comments, _ = _Comments.(*ParsedComments)
  5513  			res.TableExprs, _ = _TableExprs.(TableExprs)
  5514  			res.Exprs, _ = _Exprs.(UpdateExprs)
  5515  			res.Where, _ = _Where.(*Where)
  5516  			res.OrderBy, _ = _OrderBy.(OrderBy)
  5517  			res.Limit, _ = _Limit.(*Limit)
  5518  			out = &res
  5519  			if c.cloned != nil {
  5520  				c.cloned(n, out)
  5521  			}
  5522  			changed = true
  5523  		}
  5524  	}
  5525  	if c.post != nil {
  5526  		out, changed = c.postVisit(out, parent, changed)
  5527  	}
  5528  	return
  5529  }
  5530  func (c *cow) copyOnRewriteRefOfUpdateExpr(n *UpdateExpr, parent SQLNode) (out SQLNode, changed bool) {
  5531  	if n == nil || c.cursor.stop {
  5532  		return n, false
  5533  	}
  5534  	out = n
  5535  	if c.pre == nil || c.pre(n, parent) {
  5536  		_Name, changedName := c.copyOnRewriteRefOfColName(n.Name, n)
  5537  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  5538  		if changedName || changedExpr {
  5539  			res := *n
  5540  			res.Name, _ = _Name.(*ColName)
  5541  			res.Expr, _ = _Expr.(Expr)
  5542  			out = &res
  5543  			if c.cloned != nil {
  5544  				c.cloned(n, out)
  5545  			}
  5546  			changed = true
  5547  		}
  5548  	}
  5549  	if c.post != nil {
  5550  		out, changed = c.postVisit(out, parent, changed)
  5551  	}
  5552  	return
  5553  }
  5554  func (c *cow) copyOnRewriteUpdateExprs(n UpdateExprs, parent SQLNode) (out SQLNode, changed bool) {
  5555  	if n == nil || c.cursor.stop {
  5556  		return n, false
  5557  	}
  5558  	out = n
  5559  	if c.pre == nil || c.pre(n, parent) {
  5560  		res := make(UpdateExprs, len(n))
  5561  		for x, el := range n {
  5562  			this, change := c.copyOnRewriteRefOfUpdateExpr(el, n)
  5563  			res[x] = this.(*UpdateExpr)
  5564  			if change {
  5565  				changed = true
  5566  			}
  5567  		}
  5568  		if changed {
  5569  			out = res
  5570  		}
  5571  	}
  5572  	if c.post != nil {
  5573  		out, changed = c.postVisit(out, parent, changed)
  5574  	}
  5575  	return
  5576  }
  5577  func (c *cow) copyOnRewriteRefOfUpdateXMLExpr(n *UpdateXMLExpr, parent SQLNode) (out SQLNode, changed bool) {
  5578  	if n == nil || c.cursor.stop {
  5579  		return n, false
  5580  	}
  5581  	out = n
  5582  	if c.pre == nil || c.pre(n, parent) {
  5583  		_Target, changedTarget := c.copyOnRewriteExpr(n.Target, n)
  5584  		_XPathExpr, changedXPathExpr := c.copyOnRewriteExpr(n.XPathExpr, n)
  5585  		_NewXML, changedNewXML := c.copyOnRewriteExpr(n.NewXML, n)
  5586  		if changedTarget || changedXPathExpr || changedNewXML {
  5587  			res := *n
  5588  			res.Target, _ = _Target.(Expr)
  5589  			res.XPathExpr, _ = _XPathExpr.(Expr)
  5590  			res.NewXML, _ = _NewXML.(Expr)
  5591  			out = &res
  5592  			if c.cloned != nil {
  5593  				c.cloned(n, out)
  5594  			}
  5595  			changed = true
  5596  		}
  5597  	}
  5598  	if c.post != nil {
  5599  		out, changed = c.postVisit(out, parent, changed)
  5600  	}
  5601  	return
  5602  }
  5603  func (c *cow) copyOnRewriteRefOfUse(n *Use, parent SQLNode) (out SQLNode, changed bool) {
  5604  	if n == nil || c.cursor.stop {
  5605  		return n, false
  5606  	}
  5607  	out = n
  5608  	if c.pre == nil || c.pre(n, parent) {
  5609  		_DBName, changedDBName := c.copyOnRewriteIdentifierCS(n.DBName, n)
  5610  		if changedDBName {
  5611  			res := *n
  5612  			res.DBName, _ = _DBName.(IdentifierCS)
  5613  			out = &res
  5614  			if c.cloned != nil {
  5615  				c.cloned(n, out)
  5616  			}
  5617  			changed = true
  5618  		}
  5619  	}
  5620  	if c.post != nil {
  5621  		out, changed = c.postVisit(out, parent, changed)
  5622  	}
  5623  	return
  5624  }
  5625  func (c *cow) copyOnRewriteRefOfVExplainStmt(n *VExplainStmt, parent SQLNode) (out SQLNode, changed bool) {
  5626  	if n == nil || c.cursor.stop {
  5627  		return n, false
  5628  	}
  5629  	out = n
  5630  	if c.pre == nil || c.pre(n, parent) {
  5631  		_Statement, changedStatement := c.copyOnRewriteStatement(n.Statement, n)
  5632  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  5633  		if changedStatement || changedComments {
  5634  			res := *n
  5635  			res.Statement, _ = _Statement.(Statement)
  5636  			res.Comments, _ = _Comments.(*ParsedComments)
  5637  			out = &res
  5638  			if c.cloned != nil {
  5639  				c.cloned(n, out)
  5640  			}
  5641  			changed = true
  5642  		}
  5643  	}
  5644  	if c.post != nil {
  5645  		out, changed = c.postVisit(out, parent, changed)
  5646  	}
  5647  	return
  5648  }
  5649  func (c *cow) copyOnRewriteRefOfVStream(n *VStream, parent SQLNode) (out SQLNode, changed bool) {
  5650  	if n == nil || c.cursor.stop {
  5651  		return n, false
  5652  	}
  5653  	out = n
  5654  	if c.pre == nil || c.pre(n, parent) {
  5655  		_Comments, changedComments := c.copyOnRewriteRefOfParsedComments(n.Comments, n)
  5656  		_SelectExpr, changedSelectExpr := c.copyOnRewriteSelectExpr(n.SelectExpr, n)
  5657  		_Table, changedTable := c.copyOnRewriteTableName(n.Table, n)
  5658  		_Where, changedWhere := c.copyOnRewriteRefOfWhere(n.Where, n)
  5659  		_Limit, changedLimit := c.copyOnRewriteRefOfLimit(n.Limit, n)
  5660  		if changedComments || changedSelectExpr || changedTable || changedWhere || changedLimit {
  5661  			res := *n
  5662  			res.Comments, _ = _Comments.(*ParsedComments)
  5663  			res.SelectExpr, _ = _SelectExpr.(SelectExpr)
  5664  			res.Table, _ = _Table.(TableName)
  5665  			res.Where, _ = _Where.(*Where)
  5666  			res.Limit, _ = _Limit.(*Limit)
  5667  			out = &res
  5668  			if c.cloned != nil {
  5669  				c.cloned(n, out)
  5670  			}
  5671  			changed = true
  5672  		}
  5673  	}
  5674  	if c.post != nil {
  5675  		out, changed = c.postVisit(out, parent, changed)
  5676  	}
  5677  	return
  5678  }
  5679  func (c *cow) copyOnRewriteValTuple(n ValTuple, parent SQLNode) (out SQLNode, changed bool) {
  5680  	if n == nil || c.cursor.stop {
  5681  		return n, false
  5682  	}
  5683  	out = n
  5684  	if c.pre == nil || c.pre(n, parent) {
  5685  		res := make(ValTuple, len(n))
  5686  		for x, el := range n {
  5687  			this, change := c.copyOnRewriteExpr(el, n)
  5688  			res[x] = this.(Expr)
  5689  			if change {
  5690  				changed = true
  5691  			}
  5692  		}
  5693  		if changed {
  5694  			out = res
  5695  		}
  5696  	}
  5697  	if c.post != nil {
  5698  		out, changed = c.postVisit(out, parent, changed)
  5699  	}
  5700  	return
  5701  }
  5702  func (c *cow) copyOnRewriteRefOfValidation(n *Validation, parent SQLNode) (out SQLNode, changed bool) {
  5703  	if n == nil || c.cursor.stop {
  5704  		return n, false
  5705  	}
  5706  	out = n
  5707  	if c.pre == nil || c.pre(n, parent) {
  5708  	}
  5709  	if c.post != nil {
  5710  		out, changed = c.postVisit(out, parent, changed)
  5711  	}
  5712  	return
  5713  }
  5714  func (c *cow) copyOnRewriteValues(n Values, parent SQLNode) (out SQLNode, changed bool) {
  5715  	if n == nil || c.cursor.stop {
  5716  		return n, false
  5717  	}
  5718  	out = n
  5719  	if c.pre == nil || c.pre(n, parent) {
  5720  		res := make(Values, len(n))
  5721  		for x, el := range n {
  5722  			this, change := c.copyOnRewriteValTuple(el, n)
  5723  			res[x] = this.(ValTuple)
  5724  			if change {
  5725  				changed = true
  5726  			}
  5727  		}
  5728  		if changed {
  5729  			out = res
  5730  		}
  5731  	}
  5732  	if c.post != nil {
  5733  		out, changed = c.postVisit(out, parent, changed)
  5734  	}
  5735  	return
  5736  }
  5737  func (c *cow) copyOnRewriteRefOfValuesFuncExpr(n *ValuesFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  5738  	if n == nil || c.cursor.stop {
  5739  		return n, false
  5740  	}
  5741  	out = n
  5742  	if c.pre == nil || c.pre(n, parent) {
  5743  		_Name, changedName := c.copyOnRewriteRefOfColName(n.Name, n)
  5744  		if changedName {
  5745  			res := *n
  5746  			res.Name, _ = _Name.(*ColName)
  5747  			out = &res
  5748  			if c.cloned != nil {
  5749  				c.cloned(n, out)
  5750  			}
  5751  			changed = true
  5752  		}
  5753  	}
  5754  	if c.post != nil {
  5755  		out, changed = c.postVisit(out, parent, changed)
  5756  	}
  5757  	return
  5758  }
  5759  func (c *cow) copyOnRewriteRefOfVarPop(n *VarPop, parent SQLNode) (out SQLNode, changed bool) {
  5760  	if n == nil || c.cursor.stop {
  5761  		return n, false
  5762  	}
  5763  	out = n
  5764  	if c.pre == nil || c.pre(n, parent) {
  5765  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  5766  		if changedArg {
  5767  			res := *n
  5768  			res.Arg, _ = _Arg.(Expr)
  5769  			out = &res
  5770  			if c.cloned != nil {
  5771  				c.cloned(n, out)
  5772  			}
  5773  			changed = true
  5774  		}
  5775  	}
  5776  	if c.post != nil {
  5777  		out, changed = c.postVisit(out, parent, changed)
  5778  	}
  5779  	return
  5780  }
  5781  func (c *cow) copyOnRewriteRefOfVarSamp(n *VarSamp, parent SQLNode) (out SQLNode, changed bool) {
  5782  	if n == nil || c.cursor.stop {
  5783  		return n, false
  5784  	}
  5785  	out = n
  5786  	if c.pre == nil || c.pre(n, parent) {
  5787  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  5788  		if changedArg {
  5789  			res := *n
  5790  			res.Arg, _ = _Arg.(Expr)
  5791  			out = &res
  5792  			if c.cloned != nil {
  5793  				c.cloned(n, out)
  5794  			}
  5795  			changed = true
  5796  		}
  5797  	}
  5798  	if c.post != nil {
  5799  		out, changed = c.postVisit(out, parent, changed)
  5800  	}
  5801  	return
  5802  }
  5803  func (c *cow) copyOnRewriteRefOfVariable(n *Variable, parent SQLNode) (out SQLNode, changed bool) {
  5804  	if n == nil || c.cursor.stop {
  5805  		return n, false
  5806  	}
  5807  	out = n
  5808  	if c.pre == nil || c.pre(n, parent) {
  5809  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  5810  		if changedName {
  5811  			res := *n
  5812  			res.Name, _ = _Name.(IdentifierCI)
  5813  			out = &res
  5814  			if c.cloned != nil {
  5815  				c.cloned(n, out)
  5816  			}
  5817  			changed = true
  5818  		}
  5819  	}
  5820  	if c.post != nil {
  5821  		out, changed = c.postVisit(out, parent, changed)
  5822  	}
  5823  	return
  5824  }
  5825  func (c *cow) copyOnRewriteRefOfVariance(n *Variance, parent SQLNode) (out SQLNode, changed bool) {
  5826  	if n == nil || c.cursor.stop {
  5827  		return n, false
  5828  	}
  5829  	out = n
  5830  	if c.pre == nil || c.pre(n, parent) {
  5831  		_Arg, changedArg := c.copyOnRewriteExpr(n.Arg, n)
  5832  		if changedArg {
  5833  			res := *n
  5834  			res.Arg, _ = _Arg.(Expr)
  5835  			out = &res
  5836  			if c.cloned != nil {
  5837  				c.cloned(n, out)
  5838  			}
  5839  			changed = true
  5840  		}
  5841  	}
  5842  	if c.post != nil {
  5843  		out, changed = c.postVisit(out, parent, changed)
  5844  	}
  5845  	return
  5846  }
  5847  func (c *cow) copyOnRewriteVindexParam(n VindexParam, parent SQLNode) (out SQLNode, changed bool) {
  5848  	out = n
  5849  	if c.pre == nil || c.pre(n, parent) {
  5850  		_Key, changedKey := c.copyOnRewriteIdentifierCI(n.Key, n)
  5851  		if changedKey {
  5852  			res := n
  5853  			res.Key, _ = _Key.(IdentifierCI)
  5854  			out = &res
  5855  			if c.cloned != nil {
  5856  				c.cloned(n, out)
  5857  			}
  5858  			changed = true
  5859  		}
  5860  	}
  5861  	if c.post != nil {
  5862  		out, changed = c.postVisit(out, parent, changed)
  5863  	}
  5864  	return
  5865  }
  5866  func (c *cow) copyOnRewriteRefOfVindexSpec(n *VindexSpec, parent SQLNode) (out SQLNode, changed bool) {
  5867  	if n == nil || c.cursor.stop {
  5868  		return n, false
  5869  	}
  5870  	out = n
  5871  	if c.pre == nil || c.pre(n, parent) {
  5872  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  5873  		_Type, changedType := c.copyOnRewriteIdentifierCI(n.Type, n)
  5874  		var changedParams bool
  5875  		_Params := make([]VindexParam, len(n.Params))
  5876  		for x, el := range n.Params {
  5877  			this, changed := c.copyOnRewriteVindexParam(el, n)
  5878  			_Params[x] = this.(VindexParam)
  5879  			if changed {
  5880  				changedParams = true
  5881  			}
  5882  		}
  5883  		if changedName || changedType || changedParams {
  5884  			res := *n
  5885  			res.Name, _ = _Name.(IdentifierCI)
  5886  			res.Type, _ = _Type.(IdentifierCI)
  5887  			res.Params = _Params
  5888  			out = &res
  5889  			if c.cloned != nil {
  5890  				c.cloned(n, out)
  5891  			}
  5892  			changed = true
  5893  		}
  5894  	}
  5895  	if c.post != nil {
  5896  		out, changed = c.postVisit(out, parent, changed)
  5897  	}
  5898  	return
  5899  }
  5900  func (c *cow) copyOnRewriteRefOfWeightStringFuncExpr(n *WeightStringFuncExpr, parent SQLNode) (out SQLNode, changed bool) {
  5901  	if n == nil || c.cursor.stop {
  5902  		return n, false
  5903  	}
  5904  	out = n
  5905  	if c.pre == nil || c.pre(n, parent) {
  5906  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  5907  		_As, changedAs := c.copyOnRewriteRefOfConvertType(n.As, n)
  5908  		if changedExpr || changedAs {
  5909  			res := *n
  5910  			res.Expr, _ = _Expr.(Expr)
  5911  			res.As, _ = _As.(*ConvertType)
  5912  			out = &res
  5913  			if c.cloned != nil {
  5914  				c.cloned(n, out)
  5915  			}
  5916  			changed = true
  5917  		}
  5918  	}
  5919  	if c.post != nil {
  5920  		out, changed = c.postVisit(out, parent, changed)
  5921  	}
  5922  	return
  5923  }
  5924  func (c *cow) copyOnRewriteRefOfWhen(n *When, parent SQLNode) (out SQLNode, changed bool) {
  5925  	if n == nil || c.cursor.stop {
  5926  		return n, false
  5927  	}
  5928  	out = n
  5929  	if c.pre == nil || c.pre(n, parent) {
  5930  		_Cond, changedCond := c.copyOnRewriteExpr(n.Cond, n)
  5931  		_Val, changedVal := c.copyOnRewriteExpr(n.Val, n)
  5932  		if changedCond || changedVal {
  5933  			res := *n
  5934  			res.Cond, _ = _Cond.(Expr)
  5935  			res.Val, _ = _Val.(Expr)
  5936  			out = &res
  5937  			if c.cloned != nil {
  5938  				c.cloned(n, out)
  5939  			}
  5940  			changed = true
  5941  		}
  5942  	}
  5943  	if c.post != nil {
  5944  		out, changed = c.postVisit(out, parent, changed)
  5945  	}
  5946  	return
  5947  }
  5948  func (c *cow) copyOnRewriteRefOfWhere(n *Where, parent SQLNode) (out SQLNode, changed bool) {
  5949  	if n == nil || c.cursor.stop {
  5950  		return n, false
  5951  	}
  5952  	out = n
  5953  	if c.pre == nil || c.pre(n, parent) {
  5954  		_Expr, changedExpr := c.copyOnRewriteExpr(n.Expr, n)
  5955  		if changedExpr {
  5956  			res := *n
  5957  			res.Expr, _ = _Expr.(Expr)
  5958  			out = &res
  5959  			if c.cloned != nil {
  5960  				c.cloned(n, out)
  5961  			}
  5962  			changed = true
  5963  		}
  5964  	}
  5965  	if c.post != nil {
  5966  		out, changed = c.postVisit(out, parent, changed)
  5967  	}
  5968  	return
  5969  }
  5970  func (c *cow) copyOnRewriteRefOfWindowDefinition(n *WindowDefinition, parent SQLNode) (out SQLNode, changed bool) {
  5971  	if n == nil || c.cursor.stop {
  5972  		return n, false
  5973  	}
  5974  	out = n
  5975  	if c.pre == nil || c.pre(n, parent) {
  5976  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  5977  		_WindowSpec, changedWindowSpec := c.copyOnRewriteRefOfWindowSpecification(n.WindowSpec, n)
  5978  		if changedName || changedWindowSpec {
  5979  			res := *n
  5980  			res.Name, _ = _Name.(IdentifierCI)
  5981  			res.WindowSpec, _ = _WindowSpec.(*WindowSpecification)
  5982  			out = &res
  5983  			if c.cloned != nil {
  5984  				c.cloned(n, out)
  5985  			}
  5986  			changed = true
  5987  		}
  5988  	}
  5989  	if c.post != nil {
  5990  		out, changed = c.postVisit(out, parent, changed)
  5991  	}
  5992  	return
  5993  }
  5994  func (c *cow) copyOnRewriteWindowDefinitions(n WindowDefinitions, parent SQLNode) (out SQLNode, changed bool) {
  5995  	if n == nil || c.cursor.stop {
  5996  		return n, false
  5997  	}
  5998  	out = n
  5999  	if c.pre == nil || c.pre(n, parent) {
  6000  		res := make(WindowDefinitions, len(n))
  6001  		for x, el := range n {
  6002  			this, change := c.copyOnRewriteRefOfWindowDefinition(el, n)
  6003  			res[x] = this.(*WindowDefinition)
  6004  			if change {
  6005  				changed = true
  6006  			}
  6007  		}
  6008  		if changed {
  6009  			out = res
  6010  		}
  6011  	}
  6012  	if c.post != nil {
  6013  		out, changed = c.postVisit(out, parent, changed)
  6014  	}
  6015  	return
  6016  }
  6017  func (c *cow) copyOnRewriteRefOfWindowSpecification(n *WindowSpecification, parent SQLNode) (out SQLNode, changed bool) {
  6018  	if n == nil || c.cursor.stop {
  6019  		return n, false
  6020  	}
  6021  	out = n
  6022  	if c.pre == nil || c.pre(n, parent) {
  6023  		_Name, changedName := c.copyOnRewriteIdentifierCI(n.Name, n)
  6024  		_PartitionClause, changedPartitionClause := c.copyOnRewriteExprs(n.PartitionClause, n)
  6025  		_OrderClause, changedOrderClause := c.copyOnRewriteOrderBy(n.OrderClause, n)
  6026  		_FrameClause, changedFrameClause := c.copyOnRewriteRefOfFrameClause(n.FrameClause, n)
  6027  		if changedName || changedPartitionClause || changedOrderClause || changedFrameClause {
  6028  			res := *n
  6029  			res.Name, _ = _Name.(IdentifierCI)
  6030  			res.PartitionClause, _ = _PartitionClause.(Exprs)
  6031  			res.OrderClause, _ = _OrderClause.(OrderBy)
  6032  			res.FrameClause, _ = _FrameClause.(*FrameClause)
  6033  			out = &res
  6034  			if c.cloned != nil {
  6035  				c.cloned(n, out)
  6036  			}
  6037  			changed = true
  6038  		}
  6039  	}
  6040  	if c.post != nil {
  6041  		out, changed = c.postVisit(out, parent, changed)
  6042  	}
  6043  	return
  6044  }
  6045  func (c *cow) copyOnRewriteRefOfWith(n *With, parent SQLNode) (out SQLNode, changed bool) {
  6046  	if n == nil || c.cursor.stop {
  6047  		return n, false
  6048  	}
  6049  	out = n
  6050  	if c.pre == nil || c.pre(n, parent) {
  6051  		var changedctes bool
  6052  		_ctes := make([]*CommonTableExpr, len(n.Ctes))
  6053  		for x, el := range n.Ctes {
  6054  			this, changed := c.copyOnRewriteRefOfCommonTableExpr(el, n)
  6055  			_ctes[x] = this.(*CommonTableExpr)
  6056  			if changed {
  6057  				changedctes = true
  6058  			}
  6059  		}
  6060  		if changedctes {
  6061  			res := *n
  6062  			res.Ctes = _ctes
  6063  			out = &res
  6064  			if c.cloned != nil {
  6065  				c.cloned(n, out)
  6066  			}
  6067  			changed = true
  6068  		}
  6069  	}
  6070  	if c.post != nil {
  6071  		out, changed = c.postVisit(out, parent, changed)
  6072  	}
  6073  	return
  6074  }
  6075  func (c *cow) copyOnRewriteRefOfXorExpr(n *XorExpr, parent SQLNode) (out SQLNode, changed bool) {
  6076  	if n == nil || c.cursor.stop {
  6077  		return n, false
  6078  	}
  6079  	out = n
  6080  	if c.pre == nil || c.pre(n, parent) {
  6081  		_Left, changedLeft := c.copyOnRewriteExpr(n.Left, n)
  6082  		_Right, changedRight := c.copyOnRewriteExpr(n.Right, n)
  6083  		if changedLeft || changedRight {
  6084  			res := *n
  6085  			res.Left, _ = _Left.(Expr)
  6086  			res.Right, _ = _Right.(Expr)
  6087  			out = &res
  6088  			if c.cloned != nil {
  6089  				c.cloned(n, out)
  6090  			}
  6091  			changed = true
  6092  		}
  6093  	}
  6094  	if c.post != nil {
  6095  		out, changed = c.postVisit(out, parent, changed)
  6096  	}
  6097  	return
  6098  }
  6099  func (c *cow) copyOnRewriteAggrFunc(n AggrFunc, parent SQLNode) (out SQLNode, changed bool) {
  6100  	if n == nil || c.cursor.stop {
  6101  		return n, false
  6102  	}
  6103  	switch n := n.(type) {
  6104  	case *Avg:
  6105  		return c.copyOnRewriteRefOfAvg(n, parent)
  6106  	case *BitAnd:
  6107  		return c.copyOnRewriteRefOfBitAnd(n, parent)
  6108  	case *BitOr:
  6109  		return c.copyOnRewriteRefOfBitOr(n, parent)
  6110  	case *BitXor:
  6111  		return c.copyOnRewriteRefOfBitXor(n, parent)
  6112  	case *Count:
  6113  		return c.copyOnRewriteRefOfCount(n, parent)
  6114  	case *CountStar:
  6115  		return c.copyOnRewriteRefOfCountStar(n, parent)
  6116  	case *GroupConcatExpr:
  6117  		return c.copyOnRewriteRefOfGroupConcatExpr(n, parent)
  6118  	case *Max:
  6119  		return c.copyOnRewriteRefOfMax(n, parent)
  6120  	case *Min:
  6121  		return c.copyOnRewriteRefOfMin(n, parent)
  6122  	case *Std:
  6123  		return c.copyOnRewriteRefOfStd(n, parent)
  6124  	case *StdDev:
  6125  		return c.copyOnRewriteRefOfStdDev(n, parent)
  6126  	case *StdPop:
  6127  		return c.copyOnRewriteRefOfStdPop(n, parent)
  6128  	case *StdSamp:
  6129  		return c.copyOnRewriteRefOfStdSamp(n, parent)
  6130  	case *Sum:
  6131  		return c.copyOnRewriteRefOfSum(n, parent)
  6132  	case *VarPop:
  6133  		return c.copyOnRewriteRefOfVarPop(n, parent)
  6134  	case *VarSamp:
  6135  		return c.copyOnRewriteRefOfVarSamp(n, parent)
  6136  	case *Variance:
  6137  		return c.copyOnRewriteRefOfVariance(n, parent)
  6138  	default:
  6139  		// this should never happen
  6140  		return nil, false
  6141  	}
  6142  }
  6143  func (c *cow) copyOnRewriteAlterOption(n AlterOption, parent SQLNode) (out SQLNode, changed bool) {
  6144  	if n == nil || c.cursor.stop {
  6145  		return n, false
  6146  	}
  6147  	switch n := n.(type) {
  6148  	case *AddColumns:
  6149  		return c.copyOnRewriteRefOfAddColumns(n, parent)
  6150  	case *AddConstraintDefinition:
  6151  		return c.copyOnRewriteRefOfAddConstraintDefinition(n, parent)
  6152  	case *AddIndexDefinition:
  6153  		return c.copyOnRewriteRefOfAddIndexDefinition(n, parent)
  6154  	case AlgorithmValue:
  6155  		return c.copyOnRewriteAlgorithmValue(n, parent)
  6156  	case *AlterCharset:
  6157  		return c.copyOnRewriteRefOfAlterCharset(n, parent)
  6158  	case *AlterCheck:
  6159  		return c.copyOnRewriteRefOfAlterCheck(n, parent)
  6160  	case *AlterColumn:
  6161  		return c.copyOnRewriteRefOfAlterColumn(n, parent)
  6162  	case *AlterIndex:
  6163  		return c.copyOnRewriteRefOfAlterIndex(n, parent)
  6164  	case *ChangeColumn:
  6165  		return c.copyOnRewriteRefOfChangeColumn(n, parent)
  6166  	case *DropColumn:
  6167  		return c.copyOnRewriteRefOfDropColumn(n, parent)
  6168  	case *DropKey:
  6169  		return c.copyOnRewriteRefOfDropKey(n, parent)
  6170  	case *Force:
  6171  		return c.copyOnRewriteRefOfForce(n, parent)
  6172  	case *KeyState:
  6173  		return c.copyOnRewriteRefOfKeyState(n, parent)
  6174  	case *LockOption:
  6175  		return c.copyOnRewriteRefOfLockOption(n, parent)
  6176  	case *ModifyColumn:
  6177  		return c.copyOnRewriteRefOfModifyColumn(n, parent)
  6178  	case *OrderByOption:
  6179  		return c.copyOnRewriteRefOfOrderByOption(n, parent)
  6180  	case *RenameColumn:
  6181  		return c.copyOnRewriteRefOfRenameColumn(n, parent)
  6182  	case *RenameIndex:
  6183  		return c.copyOnRewriteRefOfRenameIndex(n, parent)
  6184  	case *RenameTableName:
  6185  		return c.copyOnRewriteRefOfRenameTableName(n, parent)
  6186  	case TableOptions:
  6187  		return c.copyOnRewriteTableOptions(n, parent)
  6188  	case *TablespaceOperation:
  6189  		return c.copyOnRewriteRefOfTablespaceOperation(n, parent)
  6190  	case *Validation:
  6191  		return c.copyOnRewriteRefOfValidation(n, parent)
  6192  	default:
  6193  		// this should never happen
  6194  		return nil, false
  6195  	}
  6196  }
  6197  func (c *cow) copyOnRewriteCallable(n Callable, parent SQLNode) (out SQLNode, changed bool) {
  6198  	if n == nil || c.cursor.stop {
  6199  		return n, false
  6200  	}
  6201  	switch n := n.(type) {
  6202  	case *ArgumentLessWindowExpr:
  6203  		return c.copyOnRewriteRefOfArgumentLessWindowExpr(n, parent)
  6204  	case *Avg:
  6205  		return c.copyOnRewriteRefOfAvg(n, parent)
  6206  	case *CharExpr:
  6207  		return c.copyOnRewriteRefOfCharExpr(n, parent)
  6208  	case *ConvertExpr:
  6209  		return c.copyOnRewriteRefOfConvertExpr(n, parent)
  6210  	case *ConvertUsingExpr:
  6211  		return c.copyOnRewriteRefOfConvertUsingExpr(n, parent)
  6212  	case *Count:
  6213  		return c.copyOnRewriteRefOfCount(n, parent)
  6214  	case *CountStar:
  6215  		return c.copyOnRewriteRefOfCountStar(n, parent)
  6216  	case *CurTimeFuncExpr:
  6217  		return c.copyOnRewriteRefOfCurTimeFuncExpr(n, parent)
  6218  	case *ExtractFuncExpr:
  6219  		return c.copyOnRewriteRefOfExtractFuncExpr(n, parent)
  6220  	case *ExtractValueExpr:
  6221  		return c.copyOnRewriteRefOfExtractValueExpr(n, parent)
  6222  	case *FirstOrLastValueExpr:
  6223  		return c.copyOnRewriteRefOfFirstOrLastValueExpr(n, parent)
  6224  	case *FuncExpr:
  6225  		return c.copyOnRewriteRefOfFuncExpr(n, parent)
  6226  	case *GTIDFuncExpr:
  6227  		return c.copyOnRewriteRefOfGTIDFuncExpr(n, parent)
  6228  	case *GroupConcatExpr:
  6229  		return c.copyOnRewriteRefOfGroupConcatExpr(n, parent)
  6230  	case *InsertExpr:
  6231  		return c.copyOnRewriteRefOfInsertExpr(n, parent)
  6232  	case *IntervalFuncExpr:
  6233  		return c.copyOnRewriteRefOfIntervalFuncExpr(n, parent)
  6234  	case *JSONArrayExpr:
  6235  		return c.copyOnRewriteRefOfJSONArrayExpr(n, parent)
  6236  	case *JSONAttributesExpr:
  6237  		return c.copyOnRewriteRefOfJSONAttributesExpr(n, parent)
  6238  	case *JSONContainsExpr:
  6239  		return c.copyOnRewriteRefOfJSONContainsExpr(n, parent)
  6240  	case *JSONContainsPathExpr:
  6241  		return c.copyOnRewriteRefOfJSONContainsPathExpr(n, parent)
  6242  	case *JSONExtractExpr:
  6243  		return c.copyOnRewriteRefOfJSONExtractExpr(n, parent)
  6244  	case *JSONKeysExpr:
  6245  		return c.copyOnRewriteRefOfJSONKeysExpr(n, parent)
  6246  	case *JSONObjectExpr:
  6247  		return c.copyOnRewriteRefOfJSONObjectExpr(n, parent)
  6248  	case *JSONOverlapsExpr:
  6249  		return c.copyOnRewriteRefOfJSONOverlapsExpr(n, parent)
  6250  	case *JSONPrettyExpr:
  6251  		return c.copyOnRewriteRefOfJSONPrettyExpr(n, parent)
  6252  	case *JSONQuoteExpr:
  6253  		return c.copyOnRewriteRefOfJSONQuoteExpr(n, parent)
  6254  	case *JSONRemoveExpr:
  6255  		return c.copyOnRewriteRefOfJSONRemoveExpr(n, parent)
  6256  	case *JSONSchemaValidFuncExpr:
  6257  		return c.copyOnRewriteRefOfJSONSchemaValidFuncExpr(n, parent)
  6258  	case *JSONSchemaValidationReportFuncExpr:
  6259  		return c.copyOnRewriteRefOfJSONSchemaValidationReportFuncExpr(n, parent)
  6260  	case *JSONSearchExpr:
  6261  		return c.copyOnRewriteRefOfJSONSearchExpr(n, parent)
  6262  	case *JSONStorageFreeExpr:
  6263  		return c.copyOnRewriteRefOfJSONStorageFreeExpr(n, parent)
  6264  	case *JSONStorageSizeExpr:
  6265  		return c.copyOnRewriteRefOfJSONStorageSizeExpr(n, parent)
  6266  	case *JSONUnquoteExpr:
  6267  		return c.copyOnRewriteRefOfJSONUnquoteExpr(n, parent)
  6268  	case *JSONValueExpr:
  6269  		return c.copyOnRewriteRefOfJSONValueExpr(n, parent)
  6270  	case *JSONValueMergeExpr:
  6271  		return c.copyOnRewriteRefOfJSONValueMergeExpr(n, parent)
  6272  	case *JSONValueModifierExpr:
  6273  		return c.copyOnRewriteRefOfJSONValueModifierExpr(n, parent)
  6274  	case *LagLeadExpr:
  6275  		return c.copyOnRewriteRefOfLagLeadExpr(n, parent)
  6276  	case *LineStringExpr:
  6277  		return c.copyOnRewriteRefOfLineStringExpr(n, parent)
  6278  	case *LocateExpr:
  6279  		return c.copyOnRewriteRefOfLocateExpr(n, parent)
  6280  	case *MatchExpr:
  6281  		return c.copyOnRewriteRefOfMatchExpr(n, parent)
  6282  	case *Max:
  6283  		return c.copyOnRewriteRefOfMax(n, parent)
  6284  	case *MemberOfExpr:
  6285  		return c.copyOnRewriteRefOfMemberOfExpr(n, parent)
  6286  	case *Min:
  6287  		return c.copyOnRewriteRefOfMin(n, parent)
  6288  	case *NTHValueExpr:
  6289  		return c.copyOnRewriteRefOfNTHValueExpr(n, parent)
  6290  	case *NamedWindow:
  6291  		return c.copyOnRewriteRefOfNamedWindow(n, parent)
  6292  	case *NtileExpr:
  6293  		return c.copyOnRewriteRefOfNtileExpr(n, parent)
  6294  	case *PerformanceSchemaFuncExpr:
  6295  		return c.copyOnRewriteRefOfPerformanceSchemaFuncExpr(n, parent)
  6296  	case *PointExpr:
  6297  		return c.copyOnRewriteRefOfPointExpr(n, parent)
  6298  	case *RegexpInstrExpr:
  6299  		return c.copyOnRewriteRefOfRegexpInstrExpr(n, parent)
  6300  	case *RegexpLikeExpr:
  6301  		return c.copyOnRewriteRefOfRegexpLikeExpr(n, parent)
  6302  	case *RegexpReplaceExpr:
  6303  		return c.copyOnRewriteRefOfRegexpReplaceExpr(n, parent)
  6304  	case *RegexpSubstrExpr:
  6305  		return c.copyOnRewriteRefOfRegexpSubstrExpr(n, parent)
  6306  	case *SubstrExpr:
  6307  		return c.copyOnRewriteRefOfSubstrExpr(n, parent)
  6308  	case *Sum:
  6309  		return c.copyOnRewriteRefOfSum(n, parent)
  6310  	case *TimestampFuncExpr:
  6311  		return c.copyOnRewriteRefOfTimestampFuncExpr(n, parent)
  6312  	case *TrimFuncExpr:
  6313  		return c.copyOnRewriteRefOfTrimFuncExpr(n, parent)
  6314  	case *UpdateXMLExpr:
  6315  		return c.copyOnRewriteRefOfUpdateXMLExpr(n, parent)
  6316  	case *ValuesFuncExpr:
  6317  		return c.copyOnRewriteRefOfValuesFuncExpr(n, parent)
  6318  	case *WeightStringFuncExpr:
  6319  		return c.copyOnRewriteRefOfWeightStringFuncExpr(n, parent)
  6320  	default:
  6321  		// this should never happen
  6322  		return nil, false
  6323  	}
  6324  }
  6325  func (c *cow) copyOnRewriteColTuple(n ColTuple, parent SQLNode) (out SQLNode, changed bool) {
  6326  	if n == nil || c.cursor.stop {
  6327  		return n, false
  6328  	}
  6329  	switch n := n.(type) {
  6330  	case ListArg:
  6331  		return c.copyOnRewriteListArg(n, parent)
  6332  	case *Subquery:
  6333  		return c.copyOnRewriteRefOfSubquery(n, parent)
  6334  	case ValTuple:
  6335  		return c.copyOnRewriteValTuple(n, parent)
  6336  	default:
  6337  		// this should never happen
  6338  		return nil, false
  6339  	}
  6340  }
  6341  func (c *cow) copyOnRewriteConstraintInfo(n ConstraintInfo, parent SQLNode) (out SQLNode, changed bool) {
  6342  	if n == nil || c.cursor.stop {
  6343  		return n, false
  6344  	}
  6345  	switch n := n.(type) {
  6346  	case *CheckConstraintDefinition:
  6347  		return c.copyOnRewriteRefOfCheckConstraintDefinition(n, parent)
  6348  	case *ForeignKeyDefinition:
  6349  		return c.copyOnRewriteRefOfForeignKeyDefinition(n, parent)
  6350  	default:
  6351  		// this should never happen
  6352  		return nil, false
  6353  	}
  6354  }
  6355  func (c *cow) copyOnRewriteDBDDLStatement(n DBDDLStatement, parent SQLNode) (out SQLNode, changed bool) {
  6356  	if n == nil || c.cursor.stop {
  6357  		return n, false
  6358  	}
  6359  	switch n := n.(type) {
  6360  	case *AlterDatabase:
  6361  		return c.copyOnRewriteRefOfAlterDatabase(n, parent)
  6362  	case *CreateDatabase:
  6363  		return c.copyOnRewriteRefOfCreateDatabase(n, parent)
  6364  	case *DropDatabase:
  6365  		return c.copyOnRewriteRefOfDropDatabase(n, parent)
  6366  	default:
  6367  		// this should never happen
  6368  		return nil, false
  6369  	}
  6370  }
  6371  func (c *cow) copyOnRewriteDDLStatement(n DDLStatement, parent SQLNode) (out SQLNode, changed bool) {
  6372  	if n == nil || c.cursor.stop {
  6373  		return n, false
  6374  	}
  6375  	switch n := n.(type) {
  6376  	case *AlterTable:
  6377  		return c.copyOnRewriteRefOfAlterTable(n, parent)
  6378  	case *AlterView:
  6379  		return c.copyOnRewriteRefOfAlterView(n, parent)
  6380  	case *CreateTable:
  6381  		return c.copyOnRewriteRefOfCreateTable(n, parent)
  6382  	case *CreateView:
  6383  		return c.copyOnRewriteRefOfCreateView(n, parent)
  6384  	case *DropTable:
  6385  		return c.copyOnRewriteRefOfDropTable(n, parent)
  6386  	case *DropView:
  6387  		return c.copyOnRewriteRefOfDropView(n, parent)
  6388  	case *RenameTable:
  6389  		return c.copyOnRewriteRefOfRenameTable(n, parent)
  6390  	case *TruncateTable:
  6391  		return c.copyOnRewriteRefOfTruncateTable(n, parent)
  6392  	default:
  6393  		// this should never happen
  6394  		return nil, false
  6395  	}
  6396  }
  6397  func (c *cow) copyOnRewriteExplain(n Explain, parent SQLNode) (out SQLNode, changed bool) {
  6398  	if n == nil || c.cursor.stop {
  6399  		return n, false
  6400  	}
  6401  	switch n := n.(type) {
  6402  	case *ExplainStmt:
  6403  		return c.copyOnRewriteRefOfExplainStmt(n, parent)
  6404  	case *ExplainTab:
  6405  		return c.copyOnRewriteRefOfExplainTab(n, parent)
  6406  	default:
  6407  		// this should never happen
  6408  		return nil, false
  6409  	}
  6410  }
  6411  func (c *cow) copyOnRewriteExpr(n Expr, parent SQLNode) (out SQLNode, changed bool) {
  6412  	if n == nil || c.cursor.stop {
  6413  		return n, false
  6414  	}
  6415  	switch n := n.(type) {
  6416  	case *AndExpr:
  6417  		return c.copyOnRewriteRefOfAndExpr(n, parent)
  6418  	case Argument:
  6419  		return c.copyOnRewriteArgument(n, parent)
  6420  	case *ArgumentLessWindowExpr:
  6421  		return c.copyOnRewriteRefOfArgumentLessWindowExpr(n, parent)
  6422  	case *Avg:
  6423  		return c.copyOnRewriteRefOfAvg(n, parent)
  6424  	case *BetweenExpr:
  6425  		return c.copyOnRewriteRefOfBetweenExpr(n, parent)
  6426  	case *BinaryExpr:
  6427  		return c.copyOnRewriteRefOfBinaryExpr(n, parent)
  6428  	case *BitAnd:
  6429  		return c.copyOnRewriteRefOfBitAnd(n, parent)
  6430  	case *BitOr:
  6431  		return c.copyOnRewriteRefOfBitOr(n, parent)
  6432  	case *BitXor:
  6433  		return c.copyOnRewriteRefOfBitXor(n, parent)
  6434  	case BoolVal:
  6435  		return c.copyOnRewriteBoolVal(n, parent)
  6436  	case *CaseExpr:
  6437  		return c.copyOnRewriteRefOfCaseExpr(n, parent)
  6438  	case *CastExpr:
  6439  		return c.copyOnRewriteRefOfCastExpr(n, parent)
  6440  	case *CharExpr:
  6441  		return c.copyOnRewriteRefOfCharExpr(n, parent)
  6442  	case *ColName:
  6443  		return c.copyOnRewriteRefOfColName(n, parent)
  6444  	case *CollateExpr:
  6445  		return c.copyOnRewriteRefOfCollateExpr(n, parent)
  6446  	case *ComparisonExpr:
  6447  		return c.copyOnRewriteRefOfComparisonExpr(n, parent)
  6448  	case *ConvertExpr:
  6449  		return c.copyOnRewriteRefOfConvertExpr(n, parent)
  6450  	case *ConvertUsingExpr:
  6451  		return c.copyOnRewriteRefOfConvertUsingExpr(n, parent)
  6452  	case *Count:
  6453  		return c.copyOnRewriteRefOfCount(n, parent)
  6454  	case *CountStar:
  6455  		return c.copyOnRewriteRefOfCountStar(n, parent)
  6456  	case *CurTimeFuncExpr:
  6457  		return c.copyOnRewriteRefOfCurTimeFuncExpr(n, parent)
  6458  	case *Default:
  6459  		return c.copyOnRewriteRefOfDefault(n, parent)
  6460  	case *ExistsExpr:
  6461  		return c.copyOnRewriteRefOfExistsExpr(n, parent)
  6462  	case *ExtractFuncExpr:
  6463  		return c.copyOnRewriteRefOfExtractFuncExpr(n, parent)
  6464  	case *ExtractValueExpr:
  6465  		return c.copyOnRewriteRefOfExtractValueExpr(n, parent)
  6466  	case *ExtractedSubquery:
  6467  		return c.copyOnRewriteRefOfExtractedSubquery(n, parent)
  6468  	case *FirstOrLastValueExpr:
  6469  		return c.copyOnRewriteRefOfFirstOrLastValueExpr(n, parent)
  6470  	case *FuncExpr:
  6471  		return c.copyOnRewriteRefOfFuncExpr(n, parent)
  6472  	case *GTIDFuncExpr:
  6473  		return c.copyOnRewriteRefOfGTIDFuncExpr(n, parent)
  6474  	case *GroupConcatExpr:
  6475  		return c.copyOnRewriteRefOfGroupConcatExpr(n, parent)
  6476  	case *InsertExpr:
  6477  		return c.copyOnRewriteRefOfInsertExpr(n, parent)
  6478  	case *IntervalExpr:
  6479  		return c.copyOnRewriteRefOfIntervalExpr(n, parent)
  6480  	case *IntervalFuncExpr:
  6481  		return c.copyOnRewriteRefOfIntervalFuncExpr(n, parent)
  6482  	case *IntroducerExpr:
  6483  		return c.copyOnRewriteRefOfIntroducerExpr(n, parent)
  6484  	case *IsExpr:
  6485  		return c.copyOnRewriteRefOfIsExpr(n, parent)
  6486  	case *JSONArrayExpr:
  6487  		return c.copyOnRewriteRefOfJSONArrayExpr(n, parent)
  6488  	case *JSONAttributesExpr:
  6489  		return c.copyOnRewriteRefOfJSONAttributesExpr(n, parent)
  6490  	case *JSONContainsExpr:
  6491  		return c.copyOnRewriteRefOfJSONContainsExpr(n, parent)
  6492  	case *JSONContainsPathExpr:
  6493  		return c.copyOnRewriteRefOfJSONContainsPathExpr(n, parent)
  6494  	case *JSONExtractExpr:
  6495  		return c.copyOnRewriteRefOfJSONExtractExpr(n, parent)
  6496  	case *JSONKeysExpr:
  6497  		return c.copyOnRewriteRefOfJSONKeysExpr(n, parent)
  6498  	case *JSONObjectExpr:
  6499  		return c.copyOnRewriteRefOfJSONObjectExpr(n, parent)
  6500  	case *JSONOverlapsExpr:
  6501  		return c.copyOnRewriteRefOfJSONOverlapsExpr(n, parent)
  6502  	case *JSONPrettyExpr:
  6503  		return c.copyOnRewriteRefOfJSONPrettyExpr(n, parent)
  6504  	case *JSONQuoteExpr:
  6505  		return c.copyOnRewriteRefOfJSONQuoteExpr(n, parent)
  6506  	case *JSONRemoveExpr:
  6507  		return c.copyOnRewriteRefOfJSONRemoveExpr(n, parent)
  6508  	case *JSONSchemaValidFuncExpr:
  6509  		return c.copyOnRewriteRefOfJSONSchemaValidFuncExpr(n, parent)
  6510  	case *JSONSchemaValidationReportFuncExpr:
  6511  		return c.copyOnRewriteRefOfJSONSchemaValidationReportFuncExpr(n, parent)
  6512  	case *JSONSearchExpr:
  6513  		return c.copyOnRewriteRefOfJSONSearchExpr(n, parent)
  6514  	case *JSONStorageFreeExpr:
  6515  		return c.copyOnRewriteRefOfJSONStorageFreeExpr(n, parent)
  6516  	case *JSONStorageSizeExpr:
  6517  		return c.copyOnRewriteRefOfJSONStorageSizeExpr(n, parent)
  6518  	case *JSONUnquoteExpr:
  6519  		return c.copyOnRewriteRefOfJSONUnquoteExpr(n, parent)
  6520  	case *JSONValueExpr:
  6521  		return c.copyOnRewriteRefOfJSONValueExpr(n, parent)
  6522  	case *JSONValueMergeExpr:
  6523  		return c.copyOnRewriteRefOfJSONValueMergeExpr(n, parent)
  6524  	case *JSONValueModifierExpr:
  6525  		return c.copyOnRewriteRefOfJSONValueModifierExpr(n, parent)
  6526  	case *LagLeadExpr:
  6527  		return c.copyOnRewriteRefOfLagLeadExpr(n, parent)
  6528  	case *LineStringExpr:
  6529  		return c.copyOnRewriteRefOfLineStringExpr(n, parent)
  6530  	case ListArg:
  6531  		return c.copyOnRewriteListArg(n, parent)
  6532  	case *Literal:
  6533  		return c.copyOnRewriteRefOfLiteral(n, parent)
  6534  	case *LocateExpr:
  6535  		return c.copyOnRewriteRefOfLocateExpr(n, parent)
  6536  	case *LockingFunc:
  6537  		return c.copyOnRewriteRefOfLockingFunc(n, parent)
  6538  	case *MatchExpr:
  6539  		return c.copyOnRewriteRefOfMatchExpr(n, parent)
  6540  	case *Max:
  6541  		return c.copyOnRewriteRefOfMax(n, parent)
  6542  	case *MemberOfExpr:
  6543  		return c.copyOnRewriteRefOfMemberOfExpr(n, parent)
  6544  	case *Min:
  6545  		return c.copyOnRewriteRefOfMin(n, parent)
  6546  	case *NTHValueExpr:
  6547  		return c.copyOnRewriteRefOfNTHValueExpr(n, parent)
  6548  	case *NamedWindow:
  6549  		return c.copyOnRewriteRefOfNamedWindow(n, parent)
  6550  	case *NotExpr:
  6551  		return c.copyOnRewriteRefOfNotExpr(n, parent)
  6552  	case *NtileExpr:
  6553  		return c.copyOnRewriteRefOfNtileExpr(n, parent)
  6554  	case *NullVal:
  6555  		return c.copyOnRewriteRefOfNullVal(n, parent)
  6556  	case *Offset:
  6557  		return c.copyOnRewriteRefOfOffset(n, parent)
  6558  	case *OrExpr:
  6559  		return c.copyOnRewriteRefOfOrExpr(n, parent)
  6560  	case *PerformanceSchemaFuncExpr:
  6561  		return c.copyOnRewriteRefOfPerformanceSchemaFuncExpr(n, parent)
  6562  	case *PointExpr:
  6563  		return c.copyOnRewriteRefOfPointExpr(n, parent)
  6564  	case *RegexpInstrExpr:
  6565  		return c.copyOnRewriteRefOfRegexpInstrExpr(n, parent)
  6566  	case *RegexpLikeExpr:
  6567  		return c.copyOnRewriteRefOfRegexpLikeExpr(n, parent)
  6568  	case *RegexpReplaceExpr:
  6569  		return c.copyOnRewriteRefOfRegexpReplaceExpr(n, parent)
  6570  	case *RegexpSubstrExpr:
  6571  		return c.copyOnRewriteRefOfRegexpSubstrExpr(n, parent)
  6572  	case *Std:
  6573  		return c.copyOnRewriteRefOfStd(n, parent)
  6574  	case *StdDev:
  6575  		return c.copyOnRewriteRefOfStdDev(n, parent)
  6576  	case *StdPop:
  6577  		return c.copyOnRewriteRefOfStdPop(n, parent)
  6578  	case *StdSamp:
  6579  		return c.copyOnRewriteRefOfStdSamp(n, parent)
  6580  	case *Subquery:
  6581  		return c.copyOnRewriteRefOfSubquery(n, parent)
  6582  	case *SubstrExpr:
  6583  		return c.copyOnRewriteRefOfSubstrExpr(n, parent)
  6584  	case *Sum:
  6585  		return c.copyOnRewriteRefOfSum(n, parent)
  6586  	case *TimestampFuncExpr:
  6587  		return c.copyOnRewriteRefOfTimestampFuncExpr(n, parent)
  6588  	case *TrimFuncExpr:
  6589  		return c.copyOnRewriteRefOfTrimFuncExpr(n, parent)
  6590  	case *UnaryExpr:
  6591  		return c.copyOnRewriteRefOfUnaryExpr(n, parent)
  6592  	case *UpdateXMLExpr:
  6593  		return c.copyOnRewriteRefOfUpdateXMLExpr(n, parent)
  6594  	case ValTuple:
  6595  		return c.copyOnRewriteValTuple(n, parent)
  6596  	case *ValuesFuncExpr:
  6597  		return c.copyOnRewriteRefOfValuesFuncExpr(n, parent)
  6598  	case *VarPop:
  6599  		return c.copyOnRewriteRefOfVarPop(n, parent)
  6600  	case *VarSamp:
  6601  		return c.copyOnRewriteRefOfVarSamp(n, parent)
  6602  	case *Variable:
  6603  		return c.copyOnRewriteRefOfVariable(n, parent)
  6604  	case *Variance:
  6605  		return c.copyOnRewriteRefOfVariance(n, parent)
  6606  	case *WeightStringFuncExpr:
  6607  		return c.copyOnRewriteRefOfWeightStringFuncExpr(n, parent)
  6608  	case *XorExpr:
  6609  		return c.copyOnRewriteRefOfXorExpr(n, parent)
  6610  	default:
  6611  		// this should never happen
  6612  		return nil, false
  6613  	}
  6614  }
  6615  func (c *cow) copyOnRewriteInsertRows(n InsertRows, parent SQLNode) (out SQLNode, changed bool) {
  6616  	if n == nil || c.cursor.stop {
  6617  		return n, false
  6618  	}
  6619  	switch n := n.(type) {
  6620  	case *Select:
  6621  		return c.copyOnRewriteRefOfSelect(n, parent)
  6622  	case *Union:
  6623  		return c.copyOnRewriteRefOfUnion(n, parent)
  6624  	case Values:
  6625  		return c.copyOnRewriteValues(n, parent)
  6626  	default:
  6627  		// this should never happen
  6628  		return nil, false
  6629  	}
  6630  }
  6631  func (c *cow) copyOnRewriteSelectExpr(n SelectExpr, parent SQLNode) (out SQLNode, changed bool) {
  6632  	if n == nil || c.cursor.stop {
  6633  		return n, false
  6634  	}
  6635  	switch n := n.(type) {
  6636  	case *AliasedExpr:
  6637  		return c.copyOnRewriteRefOfAliasedExpr(n, parent)
  6638  	case *Nextval:
  6639  		return c.copyOnRewriteRefOfNextval(n, parent)
  6640  	case *StarExpr:
  6641  		return c.copyOnRewriteRefOfStarExpr(n, parent)
  6642  	default:
  6643  		// this should never happen
  6644  		return nil, false
  6645  	}
  6646  }
  6647  func (c *cow) copyOnRewriteSelectStatement(n SelectStatement, parent SQLNode) (out SQLNode, changed bool) {
  6648  	if n == nil || c.cursor.stop {
  6649  		return n, false
  6650  	}
  6651  	switch n := n.(type) {
  6652  	case *Select:
  6653  		return c.copyOnRewriteRefOfSelect(n, parent)
  6654  	case *Union:
  6655  		return c.copyOnRewriteRefOfUnion(n, parent)
  6656  	default:
  6657  		// this should never happen
  6658  		return nil, false
  6659  	}
  6660  }
  6661  func (c *cow) copyOnRewriteShowInternal(n ShowInternal, parent SQLNode) (out SQLNode, changed bool) {
  6662  	if n == nil || c.cursor.stop {
  6663  		return n, false
  6664  	}
  6665  	switch n := n.(type) {
  6666  	case *ShowBasic:
  6667  		return c.copyOnRewriteRefOfShowBasic(n, parent)
  6668  	case *ShowCreate:
  6669  		return c.copyOnRewriteRefOfShowCreate(n, parent)
  6670  	case *ShowOther:
  6671  		return c.copyOnRewriteRefOfShowOther(n, parent)
  6672  	default:
  6673  		// this should never happen
  6674  		return nil, false
  6675  	}
  6676  }
  6677  func (c *cow) copyOnRewriteSimpleTableExpr(n SimpleTableExpr, parent SQLNode) (out SQLNode, changed bool) {
  6678  	if n == nil || c.cursor.stop {
  6679  		return n, false
  6680  	}
  6681  	switch n := n.(type) {
  6682  	case *DerivedTable:
  6683  		return c.copyOnRewriteRefOfDerivedTable(n, parent)
  6684  	case TableName:
  6685  		return c.copyOnRewriteTableName(n, parent)
  6686  	default:
  6687  		// this should never happen
  6688  		return nil, false
  6689  	}
  6690  }
  6691  func (c *cow) copyOnRewriteStatement(n Statement, parent SQLNode) (out SQLNode, changed bool) {
  6692  	if n == nil || c.cursor.stop {
  6693  		return n, false
  6694  	}
  6695  	switch n := n.(type) {
  6696  	case *AlterDatabase:
  6697  		return c.copyOnRewriteRefOfAlterDatabase(n, parent)
  6698  	case *AlterMigration:
  6699  		return c.copyOnRewriteRefOfAlterMigration(n, parent)
  6700  	case *AlterTable:
  6701  		return c.copyOnRewriteRefOfAlterTable(n, parent)
  6702  	case *AlterView:
  6703  		return c.copyOnRewriteRefOfAlterView(n, parent)
  6704  	case *AlterVschema:
  6705  		return c.copyOnRewriteRefOfAlterVschema(n, parent)
  6706  	case *Begin:
  6707  		return c.copyOnRewriteRefOfBegin(n, parent)
  6708  	case *CallProc:
  6709  		return c.copyOnRewriteRefOfCallProc(n, parent)
  6710  	case *CommentOnly:
  6711  		return c.copyOnRewriteRefOfCommentOnly(n, parent)
  6712  	case *Commit:
  6713  		return c.copyOnRewriteRefOfCommit(n, parent)
  6714  	case *CreateDatabase:
  6715  		return c.copyOnRewriteRefOfCreateDatabase(n, parent)
  6716  	case *CreateTable:
  6717  		return c.copyOnRewriteRefOfCreateTable(n, parent)
  6718  	case *CreateView:
  6719  		return c.copyOnRewriteRefOfCreateView(n, parent)
  6720  	case *DeallocateStmt:
  6721  		return c.copyOnRewriteRefOfDeallocateStmt(n, parent)
  6722  	case *Delete:
  6723  		return c.copyOnRewriteRefOfDelete(n, parent)
  6724  	case *DropDatabase:
  6725  		return c.copyOnRewriteRefOfDropDatabase(n, parent)
  6726  	case *DropTable:
  6727  		return c.copyOnRewriteRefOfDropTable(n, parent)
  6728  	case *DropView:
  6729  		return c.copyOnRewriteRefOfDropView(n, parent)
  6730  	case *ExecuteStmt:
  6731  		return c.copyOnRewriteRefOfExecuteStmt(n, parent)
  6732  	case *ExplainStmt:
  6733  		return c.copyOnRewriteRefOfExplainStmt(n, parent)
  6734  	case *ExplainTab:
  6735  		return c.copyOnRewriteRefOfExplainTab(n, parent)
  6736  	case *Flush:
  6737  		return c.copyOnRewriteRefOfFlush(n, parent)
  6738  	case *Insert:
  6739  		return c.copyOnRewriteRefOfInsert(n, parent)
  6740  	case *Load:
  6741  		return c.copyOnRewriteRefOfLoad(n, parent)
  6742  	case *LockTables:
  6743  		return c.copyOnRewriteRefOfLockTables(n, parent)
  6744  	case *OtherAdmin:
  6745  		return c.copyOnRewriteRefOfOtherAdmin(n, parent)
  6746  	case *OtherRead:
  6747  		return c.copyOnRewriteRefOfOtherRead(n, parent)
  6748  	case *PrepareStmt:
  6749  		return c.copyOnRewriteRefOfPrepareStmt(n, parent)
  6750  	case *Release:
  6751  		return c.copyOnRewriteRefOfRelease(n, parent)
  6752  	case *RenameTable:
  6753  		return c.copyOnRewriteRefOfRenameTable(n, parent)
  6754  	case *RevertMigration:
  6755  		return c.copyOnRewriteRefOfRevertMigration(n, parent)
  6756  	case *Rollback:
  6757  		return c.copyOnRewriteRefOfRollback(n, parent)
  6758  	case *SRollback:
  6759  		return c.copyOnRewriteRefOfSRollback(n, parent)
  6760  	case *Savepoint:
  6761  		return c.copyOnRewriteRefOfSavepoint(n, parent)
  6762  	case *Select:
  6763  		return c.copyOnRewriteRefOfSelect(n, parent)
  6764  	case *Set:
  6765  		return c.copyOnRewriteRefOfSet(n, parent)
  6766  	case *Show:
  6767  		return c.copyOnRewriteRefOfShow(n, parent)
  6768  	case *ShowMigrationLogs:
  6769  		return c.copyOnRewriteRefOfShowMigrationLogs(n, parent)
  6770  	case *ShowThrottledApps:
  6771  		return c.copyOnRewriteRefOfShowThrottledApps(n, parent)
  6772  	case *ShowThrottlerStatus:
  6773  		return c.copyOnRewriteRefOfShowThrottlerStatus(n, parent)
  6774  	case *Stream:
  6775  		return c.copyOnRewriteRefOfStream(n, parent)
  6776  	case *TruncateTable:
  6777  		return c.copyOnRewriteRefOfTruncateTable(n, parent)
  6778  	case *Union:
  6779  		return c.copyOnRewriteRefOfUnion(n, parent)
  6780  	case *UnlockTables:
  6781  		return c.copyOnRewriteRefOfUnlockTables(n, parent)
  6782  	case *Update:
  6783  		return c.copyOnRewriteRefOfUpdate(n, parent)
  6784  	case *Use:
  6785  		return c.copyOnRewriteRefOfUse(n, parent)
  6786  	case *VExplainStmt:
  6787  		return c.copyOnRewriteRefOfVExplainStmt(n, parent)
  6788  	case *VStream:
  6789  		return c.copyOnRewriteRefOfVStream(n, parent)
  6790  	default:
  6791  		// this should never happen
  6792  		return nil, false
  6793  	}
  6794  }
  6795  func (c *cow) copyOnRewriteTableExpr(n TableExpr, parent SQLNode) (out SQLNode, changed bool) {
  6796  	if n == nil || c.cursor.stop {
  6797  		return n, false
  6798  	}
  6799  	switch n := n.(type) {
  6800  	case *AliasedTableExpr:
  6801  		return c.copyOnRewriteRefOfAliasedTableExpr(n, parent)
  6802  	case *JSONTableExpr:
  6803  		return c.copyOnRewriteRefOfJSONTableExpr(n, parent)
  6804  	case *JoinTableExpr:
  6805  		return c.copyOnRewriteRefOfJoinTableExpr(n, parent)
  6806  	case *ParenTableExpr:
  6807  		return c.copyOnRewriteRefOfParenTableExpr(n, parent)
  6808  	default:
  6809  		// this should never happen
  6810  		return nil, false
  6811  	}
  6812  }
  6813  func (c *cow) copyOnRewriteAlgorithmValue(n AlgorithmValue, parent SQLNode) (out SQLNode, changed bool) {
  6814  	if c.cursor.stop {
  6815  		return n, false
  6816  	}
  6817  	if c.pre != nil {
  6818  		c.pre(n, parent)
  6819  	}
  6820  	if c.post != nil {
  6821  		out, changed = c.postVisit(n, parent, changed)
  6822  	} else {
  6823  		out = n
  6824  	}
  6825  	return
  6826  }
  6827  func (c *cow) copyOnRewriteArgument(n Argument, parent SQLNode) (out SQLNode, changed bool) {
  6828  	if c.cursor.stop {
  6829  		return n, false
  6830  	}
  6831  	if c.pre != nil {
  6832  		c.pre(n, parent)
  6833  	}
  6834  	if c.post != nil {
  6835  		out, changed = c.postVisit(n, parent, changed)
  6836  	} else {
  6837  		out = n
  6838  	}
  6839  	return
  6840  }
  6841  func (c *cow) copyOnRewriteBoolVal(n BoolVal, parent SQLNode) (out SQLNode, changed bool) {
  6842  	if c.cursor.stop {
  6843  		return n, false
  6844  	}
  6845  	if c.pre != nil {
  6846  		c.pre(n, parent)
  6847  	}
  6848  	if c.post != nil {
  6849  		out, changed = c.postVisit(n, parent, changed)
  6850  	} else {
  6851  		out = n
  6852  	}
  6853  	return
  6854  }
  6855  func (c *cow) copyOnRewriteListArg(n ListArg, parent SQLNode) (out SQLNode, changed bool) {
  6856  	if c.cursor.stop {
  6857  		return n, false
  6858  	}
  6859  	if c.pre != nil {
  6860  		c.pre(n, parent)
  6861  	}
  6862  	if c.post != nil {
  6863  		out, changed = c.postVisit(n, parent, changed)
  6864  	} else {
  6865  		out = n
  6866  	}
  6867  	return
  6868  }
  6869  func (c *cow) copyOnRewriteMatchAction(n MatchAction, parent SQLNode) (out SQLNode, changed bool) {
  6870  	if c.cursor.stop {
  6871  		return n, false
  6872  	}
  6873  	if c.pre != nil {
  6874  		c.pre(n, parent)
  6875  	}
  6876  	if c.post != nil {
  6877  		out, changed = c.postVisit(n, parent, changed)
  6878  	} else {
  6879  		out = n
  6880  	}
  6881  	return
  6882  }
  6883  func (c *cow) copyOnRewriteReferenceAction(n ReferenceAction, parent SQLNode) (out SQLNode, changed bool) {
  6884  	if c.cursor.stop {
  6885  		return n, false
  6886  	}
  6887  	if c.pre != nil {
  6888  		c.pre(n, parent)
  6889  	}
  6890  	if c.post != nil {
  6891  		out, changed = c.postVisit(n, parent, changed)
  6892  	} else {
  6893  		out = n
  6894  	}
  6895  	return
  6896  }
  6897  func (c *cow) copyOnRewriteRefOfIdentifierCI(n *IdentifierCI, parent SQLNode) (out SQLNode, changed bool) {
  6898  	if n == nil || c.cursor.stop {
  6899  		return n, false
  6900  	}
  6901  	out = n
  6902  	if c.pre == nil || c.pre(n, parent) {
  6903  	}
  6904  	if c.post != nil {
  6905  		out, changed = c.postVisit(out, parent, changed)
  6906  	}
  6907  	return
  6908  }
  6909  func (c *cow) copyOnRewriteRefOfIdentifierCS(n *IdentifierCS, parent SQLNode) (out SQLNode, changed bool) {
  6910  	if n == nil || c.cursor.stop {
  6911  		return n, false
  6912  	}
  6913  	out = n
  6914  	if c.pre == nil || c.pre(n, parent) {
  6915  	}
  6916  	if c.post != nil {
  6917  		out, changed = c.postVisit(out, parent, changed)
  6918  	}
  6919  	return
  6920  }
  6921  func (c *cow) copyOnRewriteRefOfRootNode(n *RootNode, parent SQLNode) (out SQLNode, changed bool) {
  6922  	if n == nil || c.cursor.stop {
  6923  		return n, false
  6924  	}
  6925  	out = n
  6926  	if c.pre == nil || c.pre(n, parent) {
  6927  		_SQLNode, changedSQLNode := c.copyOnRewriteSQLNode(n.SQLNode, n)
  6928  		if changedSQLNode {
  6929  			res := *n
  6930  			res.SQLNode, _ = _SQLNode.(SQLNode)
  6931  			out = &res
  6932  			if c.cloned != nil {
  6933  				c.cloned(n, out)
  6934  			}
  6935  			changed = true
  6936  		}
  6937  	}
  6938  	if c.post != nil {
  6939  		out, changed = c.postVisit(out, parent, changed)
  6940  	}
  6941  	return
  6942  }
  6943  func (c *cow) copyOnRewriteRefOfTableName(n *TableName, parent SQLNode) (out SQLNode, changed bool) {
  6944  	if n == nil || c.cursor.stop {
  6945  		return n, false
  6946  	}
  6947  	out = n
  6948  	if c.pre == nil || c.pre(n, parent) {
  6949  		_Name, changedName := c.copyOnRewriteIdentifierCS(n.Name, n)
  6950  		_Qualifier, changedQualifier := c.copyOnRewriteIdentifierCS(n.Qualifier, n)
  6951  		if changedName || changedQualifier {
  6952  			res := *n
  6953  			res.Name, _ = _Name.(IdentifierCS)
  6954  			res.Qualifier, _ = _Qualifier.(IdentifierCS)
  6955  			out = &res
  6956  			if c.cloned != nil {
  6957  				c.cloned(n, out)
  6958  			}
  6959  			changed = true
  6960  		}
  6961  	}
  6962  	if c.post != nil {
  6963  		out, changed = c.postVisit(out, parent, changed)
  6964  	}
  6965  	return
  6966  }
  6967  func (c *cow) copyOnRewriteRefOfVindexParam(n *VindexParam, parent SQLNode) (out SQLNode, changed bool) {
  6968  	if n == nil || c.cursor.stop {
  6969  		return n, false
  6970  	}
  6971  	out = n
  6972  	if c.pre == nil || c.pre(n, parent) {
  6973  		_Key, changedKey := c.copyOnRewriteIdentifierCI(n.Key, n)
  6974  		if changedKey {
  6975  			res := *n
  6976  			res.Key, _ = _Key.(IdentifierCI)
  6977  			out = &res
  6978  			if c.cloned != nil {
  6979  				c.cloned(n, out)
  6980  			}
  6981  			changed = true
  6982  		}
  6983  	}
  6984  	if c.post != nil {
  6985  		out, changed = c.postVisit(out, parent, changed)
  6986  	}
  6987  	return
  6988  }