github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/alter_type.go (about)

     1  // Copyright 2020 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package sql
    12  
    13  import (
    14  	"context"
    15  
    16  	"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
    17  	"github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented"
    18  	"github.com/cockroachdb/errors"
    19  )
    20  
    21  type alterTypeNode struct {
    22  	n *tree.AlterType
    23  }
    24  
    25  // alterTypeNode implements planNode. We set n here to satisfy the linter.
    26  var _ planNode = &alterTypeNode{n: nil}
    27  
    28  func (p *planner) AlterType(ctx context.Context, n *tree.AlterType) (planNode, error) {
    29  	return &alterTypeNode{n: n}, nil
    30  }
    31  
    32  func (n *alterTypeNode) startExec(params runParams) error {
    33  	switch t := n.n.Cmd.(type) {
    34  	case *tree.AlterTypeAddValue:
    35  		return unimplemented.NewWithIssue(48670, "ALTER TYPE ADD VALUE unsupported")
    36  	case *tree.AlterTypeRenameValue:
    37  		return unimplemented.NewWithIssue(48697, "ALTER TYPE RENAME VALUE unsupported")
    38  	case *tree.AlterTypeRename:
    39  		return unimplemented.NewWithIssue(48671, "ALTER TYPE RENAME unsupported")
    40  	case *tree.AlterTypeSetSchema:
    41  		return unimplemented.NewWithIssue(48672, "ALTER TYPE SET SCHEMA unsupported")
    42  	default:
    43  		return errors.AssertionFailedf("unknown alter type cmd %s", t)
    44  	}
    45  }
    46  
    47  func (n *alterTypeNode) Next(params runParams) (bool, error) { return false, nil }
    48  func (n *alterTypeNode) Values() tree.Datums                 { return tree.Datums{} }
    49  func (n *alterTypeNode) Close(ctx context.Context)           {}
    50  func (n *alterTypeNode) ReadingOwnWrites()                   {}