Skip to content

Commit

Permalink
optbuilder: reset annotations when building CREATE FUNCTION
Browse files Browse the repository at this point in the history
In 22dabb0 we started overriding the annotations for each statement
in the UDF body. We should reset them to the original values, so we
don't accidentally leave the old reference.

Release note: None
  • Loading branch information
rafiss committed Jun 28, 2023
1 parent 9147f71 commit 7e6f336
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/sql/opt/optbuilder/create_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ func (b *Builder) buildCreateFunction(cf *tree.CreateFunction, inScope *scope) (
// Reset the tracked dependencies for next statement.
b.schemaDeps = nil
b.schemaTypeDeps = intsets.Fast{}

// Reset the annotations to the original values
b.evalCtx.Annotations = oldEvalCtxAnn
b.semaCtx.Annotations = oldSemaCtxAnn
}

if targetVolatility == tree.FunctionImmutable && len(deps) > 0 {
Expand Down

0 comments on commit 7e6f336

Please sign in to comment.