Class SqlTableConstraint

  • All Implemented Interfaces:
    Cloneable

    public class SqlTableConstraint
    extends org.apache.calcite.sql.SqlCall
    Table constraint of a table definition.

    Syntax from SQL-2011 IWD 9075-2:201?(E) 11.3 <table definition>:

     <table constraint definition> ::=
       [ <constraint name definition> ] <table constraint>
           [ <constraint characteristics> ]
    
     <table constraint> ::=
         <unique constraint definition>
    
     <unique constraint definition> ::=
         <unique specification> <left paren> <unique column list> <right paren>
    
     <unique specification> ::=
         UNIQUE
       | PRIMARY KEY
     
    • Field Summary

      • Fields inherited from class org.apache.calcite.sql.SqlNode

        EMPTY_ARRAY, pos
    • Constructor Summary

      Constructors 
      Constructor Description
      SqlTableConstraint​(org.apache.calcite.sql.SqlIdentifier constraintName, org.apache.calcite.sql.SqlLiteral uniqueSpec, org.apache.calcite.sql.SqlNodeList columns, org.apache.calcite.sql.SqlLiteral enforcement, boolean isTableConstraint, org.apache.calcite.sql.parser.SqlParserPos pos)
      Creates a table constraint node.
    • Constructor Detail

      • SqlTableConstraint

        public SqlTableConstraint​(@Nullable
                                  org.apache.calcite.sql.SqlIdentifier constraintName,
                                  org.apache.calcite.sql.SqlLiteral uniqueSpec,
                                  org.apache.calcite.sql.SqlNodeList columns,
                                  @Nullable
                                  org.apache.calcite.sql.SqlLiteral enforcement,
                                  boolean isTableConstraint,
                                  org.apache.calcite.sql.parser.SqlParserPos pos)
        Creates a table constraint node.
        Parameters:
        constraintName - Constraint name
        uniqueSpec - Unique specification
        columns - Column list on which the constraint enforces or null if this is a column constraint
        enforcement - Whether the constraint is enforced
        isTableConstraint - Whether this is a table constraint
        pos - Parser position
    • Method Detail

      • getOperator

        public org.apache.calcite.sql.SqlOperator getOperator()
        Specified by:
        getOperator in class org.apache.calcite.sql.SqlCall
      • isUnique

        public boolean isUnique()
        Returns whether the constraint is UNIQUE.
      • isPrimaryKey

        public boolean isPrimaryKey()
        Returns whether the constraint is PRIMARY KEY.
      • isEnforced

        public boolean isEnforced()
        Returns whether the constraint is enforced.
      • getConstraintNameIdentifier

        public Optional<org.apache.calcite.sql.SqlIdentifier> getConstraintNameIdentifier()
      • getColumns

        public org.apache.calcite.sql.SqlNodeList getColumns()
      • isTableConstraint

        public boolean isTableConstraint()
      • getColumnNames

        public String[] getColumnNames()
        Returns the columns as a string array.
      • getOperandList

        public List<org.apache.calcite.sql.SqlNode> getOperandList()
        Specified by:
        getOperandList in class org.apache.calcite.sql.SqlCall
      • unparse

        public void unparse​(org.apache.calcite.sql.SqlWriter writer,
                            int leftPrec,
                            int rightPrec)
        Overrides:
        unparse in class org.apache.calcite.sql.SqlCall