setup
CREATE TABLE t(
  a INT PRIMARY KEY,
  b INT,
  C INT,
  INDEX t_idx_b(b),
  INDEX t_idx_c(c)
);
CREATE SEQUENCE sq1;
CREATE VIEW v AS SELECT a FROM t;
CREATE TYPE notmyworkday AS ENUM ('Monday', 'Tuesday');
CREATE FUNCTION f(a notmyworkday) RETURNS INT VOLATILE LANGUAGE SQL AS $$
  SELECT a FROM t;
  SELECT b FROM t@t_idx_b;
  SELECT c FROM t@t_idx_c;
  SELECT a FROM v;
  SELECT nextval('sq1');
$$;
----

ops
DROP FUNCTION f;
----
StatementPhase stage 1 of 1 with 14 MutationType ops
  transitions:
    [[Owner:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[UserPrivileges:{DescID: 109, Name: admin}, ABSENT], PUBLIC] -> ABSENT
    [[UserPrivileges:{DescID: 109, Name: public}, ABSENT], PUBLIC] -> ABSENT
    [[UserPrivileges:{DescID: 109, Name: root}, ABSENT], PUBLIC] -> ABSENT
    [[Function:{DescID: 109}, ABSENT], PUBLIC] -> DROPPED
    [[SchemaChild:{DescID: 109, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionName:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionVolatility:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionLeakProof:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionNullInputBehavior:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionSecurity:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionBody:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
  ops:
    *scop.MarkDescriptorAsDropped
      DescriptorID: 109
    *scop.RemoveObjectParent
      ObjectID: 109
      ParentSchemaID: 101
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionName
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionVolatility
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionLeakProof
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionNullInputBehavior
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionSecurity
    *scop.RemoveBackReferenceInTypes
      BackReferencedDescriptorID: 109
      TypeIDs:
      - 107
      - 108
    *scop.RemoveBackReferencesInRelations
      BackReferencedID: 109
      RelationIDs:
      - 104
      - 104
      - 104
      - 106
      - 105
    *scop.RemoveBackReferenceInFunctions
      BackReferencedDescriptorID: 109
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.Owner
    *scop.RemoveUserPrivileges
      DescriptorID: 109
      User: admin
    *scop.RemoveUserPrivileges
      DescriptorID: 109
      User: public
    *scop.RemoveUserPrivileges
      DescriptorID: 109
      User: root
PreCommitPhase stage 1 of 2 with 1 MutationType op
  transitions:
    [[Owner:{DescID: 109}, ABSENT], ABSENT] -> PUBLIC
    [[UserPrivileges:{DescID: 109, Name: admin}, ABSENT], ABSENT] -> PUBLIC
    [[UserPrivileges:{DescID: 109, Name: public}, ABSENT], ABSENT] -> PUBLIC
    [[UserPrivileges:{DescID: 109, Name: root}, ABSENT], ABSENT] -> PUBLIC
    [[Function:{DescID: 109}, ABSENT], DROPPED] -> PUBLIC
    [[SchemaChild:{DescID: 109, ReferencedDescID: 101}, ABSENT], ABSENT] -> PUBLIC
    [[FunctionName:{DescID: 109}, ABSENT], ABSENT] -> PUBLIC
    [[FunctionVolatility:{DescID: 109}, ABSENT], ABSENT] -> PUBLIC
    [[FunctionLeakProof:{DescID: 109}, ABSENT], ABSENT] -> PUBLIC
    [[FunctionNullInputBehavior:{DescID: 109}, ABSENT], ABSENT] -> PUBLIC
    [[FunctionSecurity:{DescID: 109}, ABSENT], ABSENT] -> PUBLIC
    [[FunctionBody:{DescID: 109}, ABSENT], ABSENT] -> PUBLIC
  ops:
    *scop.UndoAllInTxnImmediateMutationOpSideEffects
      {}
PreCommitPhase stage 2 of 2 with 21 MutationType ops
  transitions:
    [[Owner:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[UserPrivileges:{DescID: 109, Name: admin}, ABSENT], PUBLIC] -> ABSENT
    [[UserPrivileges:{DescID: 109, Name: public}, ABSENT], PUBLIC] -> ABSENT
    [[UserPrivileges:{DescID: 109, Name: root}, ABSENT], PUBLIC] -> ABSENT
    [[Function:{DescID: 109}, ABSENT], PUBLIC] -> DROPPED
    [[SchemaChild:{DescID: 109, ReferencedDescID: 101}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionName:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionVolatility:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionLeakProof:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionNullInputBehavior:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionSecurity:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
    [[FunctionBody:{DescID: 109}, ABSENT], PUBLIC] -> ABSENT
  ops:
    *scop.MarkDescriptorAsDropped
      DescriptorID: 109
    *scop.RemoveObjectParent
      ObjectID: 109
      ParentSchemaID: 101
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionName
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionVolatility
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionLeakProof
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionNullInputBehavior
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.FunctionSecurity
    *scop.RemoveBackReferenceInTypes
      BackReferencedDescriptorID: 109
      TypeIDs:
      - 107
      - 108
    *scop.RemoveBackReferencesInRelations
      BackReferencedID: 109
      RelationIDs:
      - 104
      - 104
      - 104
      - 106
      - 105
    *scop.RemoveBackReferenceInFunctions
      BackReferencedDescriptorID: 109
    *scop.NotImplementedForPublicObjects
      DescID: 109
      ElementType: scpb.Owner
    *scop.RemoveUserPrivileges
      DescriptorID: 109
      User: admin
    *scop.RemoveUserPrivileges
      DescriptorID: 109
      User: public
    *scop.RemoveUserPrivileges
      DescriptorID: 109
      User: root
    *scop.SetJobStateOnDescriptor
      DescriptorID: 104
      Initialize: true
    *scop.SetJobStateOnDescriptor
      DescriptorID: 105
      Initialize: true
    *scop.SetJobStateOnDescriptor
      DescriptorID: 106
      Initialize: true
    *scop.SetJobStateOnDescriptor
      DescriptorID: 107
      Initialize: true
    *scop.SetJobStateOnDescriptor
      DescriptorID: 108
      Initialize: true
    *scop.SetJobStateOnDescriptor
      DescriptorID: 109
      Initialize: true
    *scop.CreateSchemaChangerJob
      Authorization:
        AppName: $ internal-test
        UserName: root
      DescriptorIDs:
      - 104
      - 105
      - 106
      - 107
      - 108
      - 109
      JobID: 1
      NonCancelable: true
      RunningStatus: PostCommitNonRevertiblePhase stage 1 of 1 with 1 MutationType op pending
      Statements:
      - statement: DROP FUNCTION f
        redactedstatement: DROP FUNCTION ‹""›.‹""›.‹f›
        statementtag: DROP FUNCTION
PostCommitNonRevertiblePhase stage 1 of 1 with 8 MutationType ops
  transitions:
    [[Function:{DescID: 109}, ABSENT], DROPPED] -> ABSENT
  ops:
    *scop.DeleteDescriptor
      DescriptorID: 109
    *scop.RemoveJobStateFromDescriptor
      DescriptorID: 104
      JobID: 1
    *scop.RemoveJobStateFromDescriptor
      DescriptorID: 105
      JobID: 1
    *scop.RemoveJobStateFromDescriptor
      DescriptorID: 106
      JobID: 1
    *scop.RemoveJobStateFromDescriptor
      DescriptorID: 107
      JobID: 1
    *scop.RemoveJobStateFromDescriptor
      DescriptorID: 108
      JobID: 1
    *scop.RemoveJobStateFromDescriptor
      DescriptorID: 109
      JobID: 1
    *scop.UpdateSchemaChangerJob
      DescriptorIDsToRemove:
      - 104
      - 105
      - 106
      - 107
      - 108
      - 109
      IsNonCancelable: true
      JobID: 1
