public final ConstraintContext constraint() throws RecognitionException {
		ConstraintContext _localctx = new ConstraintContext(_ctx, getState());
		enterRule(_localctx, 58, RULE_constraint);
		int _la;
		try {
			int _alt;
			setState(519);
			switch ( getInterpreter().adaptivePredict(_input,78,_ctx) ) {
			case 1:
				_localctx = new PrimaryContext(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(420);
				_la = _input.LA(1);
				if (_la==CONSTRAINT) {
					{
					setState(419); match(CONSTRAINT);
					}
				}

				setState(423);
				_la = _input.LA(1);
				if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << STRING_G) | (1L << STRING_Q) | (1L << STRING_D) | (1L << QO) | (1L << DQ) | (1L << GR) | (1L << ACTION) | (1L << ADD) | (1L << ALTER) | (1L << ASC) | (1L << AUTO_INC) | (1L << BIGINT) | (1L << BINARY) | (1L << BIT) | (1L << BTREE) | (1L << CASCADE) | (1L << CHARACTER) | (1L << CHAR) | (1L << CHECK) | (1L << COLLATE) | (1L << COL_FORMAT) | (1L << COMMIT) | (1L << CREATE) | (1L << DATABASE) | (1L << DECIMAL) | (1L << DELETE) | (1L << DESC) | (1L << DISK) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << END) | (1L << ENUM) | (1L << EXISTS) | (1L << FIXED) | (1L << FOREIGN))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (FULLTEXT - 64)) | (1L << (FUNCTION - 64)) | (1L << (HASH - 64)) | (1L << (IF - 64)) | (1L << (IGNORE - 64)) | (1L << (INSERT - 64)) | (1L << (INTEGER - 64)) | (1L << (INTO - 64)) | (1L << (IS - 64)) | (1L << (NUMERIC - 64)) | (1L << (REAL - 64)) | (1L << (REFERENCES - 64)) | (1L << (REPLACE - 64)) | (1L << (RESTRICT - 64)) | (1L << (SCHEMA - 64)) | (1L << (SET - 64)) | (1L << (SMALLINT - 64)) | (1L << (SPATIAL - 64)) | (1L << (STORAGE - 64)) | (1L << (TABLE - 64)) | (1L << (TEMPORARY - 64)) | (1L << (UNSIGNED - 64)) | (1L << (UPDATE - 64)) | (1L << (USE - 64)) | (1L << (USING - 64)) | (1L << (VALUES - 64)) | (1L << (VARBINARY - 64)) | (1L << (VARCHAR - 64)) | (1L << (YEAR - 64)) | (1L << (ZEROFILL - 64)) | (1L << (ID - 64)))) != 0)) {
					{
					setState(422); constr_name();
					}
				}

				setState(425); match(PRIMARY);
				setState(426); match(KEY);
				setState(428);
				switch ( getInterpreter().adaptivePredict(_input,57,_ctx) ) {
				case 1:
					{
					setState(427); constr_name();
					}
					break;
				}
				setState(431);
				switch ( getInterpreter().adaptivePredict(_input,58,_ctx) ) {
				case 1:
					{
					setState(430); index_type();
					}
					break;
				}
				setState(434);
				_la = _input.LA(1);
				if (_la==LP) {
					{
					setState(433); parNameList();
					}
				}

				setState(439);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,60,_ctx);
				while ( _alt!=2 && _alt!=-1 ) {
					if ( _alt==1 ) {
						{
						{
						setState(436); index_option();
						}
						} 
					}
					setState(441);
					_errHandler.sync(this);
					_alt = getInterpreter().adaptivePredict(_input,60,_ctx);
				}
				}
				break;

			case 2:
				_localctx = new Index_keyContext(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(442);
				_la = _input.LA(1);
				if ( !(_la==INDEX || _la==KEY) ) {
				_errHandler.recoverInline(this);
				}
				consume();
				setState(444);
				switch ( getInterpreter().adaptivePredict(_input,61,_ctx) ) {
				case 1:
					{
					setState(443); index_name();
					}
					break;
				}
				setState(448);
				_la = _input.LA(1);
				if (_la==ON) {
					{
					setState(446); match(ON);
					setState(447); col_name();
					}
				}

				setState(451);
				_la = _input.LA(1);
				if (_la==USING) {
					{
					setState(450); index_type();
					}
				}

				setState(453); parNameList();
				setState(457);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,64,_ctx);
				while ( _alt!=2 && _alt!=-1 ) {
					if ( _alt==1 ) {
						{
						{
						setState(454); index_option();
						}
						} 
					}
					setState(459);
					_errHandler.sync(this);
					_alt = getInterpreter().adaptivePredict(_input,64,_ctx);
				}
				}
				break;

			case 3:
				_localctx = new UniqueContext(_localctx);
				enterOuterAlt(_localctx, 3);
				{
				setState(461);
				_la = _input.LA(1);
				if (_la==CONSTRAINT) {
					{
					setState(460); match(CONSTRAINT);
					}
				}

				setState(464);
				_la = _input.LA(1);
				if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << STRING_G) | (1L << STRING_Q) | (1L << STRING_D) | (1L << QO) | (1L << DQ) | (1L << GR) | (1L << ACTION) | (1L << ADD) | (1L << ALTER) | (1L << ASC) | (1L << AUTO_INC) | (1L << BIGINT) | (1L << BINARY) | (1L << BIT) | (1L << BTREE) | (1L << CASCADE) | (1L << CHARACTER) | (1L << CHAR) | (1L << CHECK) | (1L << COLLATE) | (1L << COL_FORMAT) | (1L << COMMIT) | (1L << CREATE) | (1L << DATABASE) | (1L << DECIMAL) | (1L << DELETE) | (1L << DESC) | (1L << DISK) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << END) | (1L << ENUM) | (1L << EXISTS) | (1L << FIXED) | (1L << FOREIGN))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (FULLTEXT - 64)) | (1L << (FUNCTION - 64)) | (1L << (HASH - 64)) | (1L << (IF - 64)) | (1L << (IGNORE - 64)) | (1L << (INSERT - 64)) | (1L << (INTEGER - 64)) | (1L << (INTO - 64)) | (1L << (IS - 64)) | (1L << (NUMERIC - 64)) | (1L << (REAL - 64)) | (1L << (REFERENCES - 64)) | (1L << (REPLACE - 64)) | (1L << (RESTRICT - 64)) | (1L << (SCHEMA - 64)) | (1L << (SET - 64)) | (1L << (SMALLINT - 64)) | (1L << (SPATIAL - 64)) | (1L << (STORAGE - 64)) | (1L << (TABLE - 64)) | (1L << (TEMPORARY - 64)) | (1L << (UNSIGNED - 64)) | (1L << (UPDATE - 64)) | (1L << (USE - 64)) | (1L << (USING - 64)) | (1L << (VALUES - 64)) | (1L << (VARBINARY - 64)) | (1L << (VARCHAR - 64)) | (1L << (YEAR - 64)) | (1L << (ZEROFILL - 64)) | (1L << (ID - 64)))) != 0)) {
					{
					setState(463); constr_name();
					}
				}

				setState(466); match(UNIQUE);
				setState(468);
				switch ( getInterpreter().adaptivePredict(_input,67,_ctx) ) {
				case 1:
					{
					setState(467);
					_la = _input.LA(1);
					if ( !(_la==INDEX || _la==KEY) ) {
					_errHandler.recoverInline(this);
					}
					consume();
					}
					break;
				}
				setState(471);
				switch ( getInterpreter().adaptivePredict(_input,68,_ctx) ) {
				case 1:
					{
					setState(470); index_name();
					}
					break;
				}
				setState(474);
				switch ( getInterpreter().adaptivePredict(_input,69,_ctx) ) {
				case 1:
					{
					setState(473); index_type();
					}
					break;
				}
				setState(477);
				_la = _input.LA(1);
				if (_la==LP) {
					{
					setState(476); parNameList();
					}
				}

				setState(482);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,71,_ctx);
				while ( _alt!=2 && _alt!=-1 ) {
					if ( _alt==1 ) {
						{
						{
						setState(479); index_option();
						}
						} 
					}
					setState(484);
					_errHandler.sync(this);
					_alt = getInterpreter().adaptivePredict(_input,71,_ctx);
				}
				}
				break;

			case 4:
				_localctx = new FulltextContext(_localctx);
				enterOuterAlt(_localctx, 4);
				{
				setState(485);
				_la = _input.LA(1);
				if ( !(_la==FULLTEXT || _la==SPATIAL) ) {
				_errHandler.recoverInline(this);
				}
				consume();
				setState(487);
				_la = _input.LA(1);
				if (_la==INDEX || _la==KEY) {
					{
					setState(486);
					_la = _input.LA(1);
					if ( !(_la==INDEX || _la==KEY) ) {
					_errHandler.recoverInline(this);
					}
					consume();
					}
				}

				setState(490);
				_la = _input.LA(1);
				if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << STRING_G) | (1L << STRING_Q) | (1L << STRING_D) | (1L << QO) | (1L << DQ) | (1L << GR) | (1L << ACTION) | (1L << ADD) | (1L << ALTER) | (1L << ASC) | (1L << AUTO_INC) | (1L << BIGINT) | (1L << BINARY) | (1L << BIT) | (1L << BTREE) | (1L << CASCADE) | (1L << CHARACTER) | (1L << CHAR) | (1L << CHECK) | (1L << COLLATE) | (1L << COL_FORMAT) | (1L << COMMIT) | (1L << CREATE) | (1L << DATABASE) | (1L << DECIMAL) | (1L << DELETE) | (1L << DESC) | (1L << DISK) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << END) | (1L << ENUM) | (1L << EXISTS) | (1L << FIXED) | (1L << FOREIGN))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (FULLTEXT - 64)) | (1L << (FUNCTION - 64)) | (1L << (HASH - 64)) | (1L << (IF - 64)) | (1L << (IGNORE - 64)) | (1L << (INSERT - 64)) | (1L << (INTEGER - 64)) | (1L << (INTO - 64)) | (1L << (IS - 64)) | (1L << (NUMERIC - 64)) | (1L << (REAL - 64)) | (1L << (REFERENCES - 64)) | (1L << (REPLACE - 64)) | (1L << (RESTRICT - 64)) | (1L << (SCHEMA - 64)) | (1L << (SET - 64)) | (1L << (SMALLINT - 64)) | (1L << (SPATIAL - 64)) | (1L << (STORAGE - 64)) | (1L << (TABLE - 64)) | (1L << (TEMPORARY - 64)) | (1L << (UNSIGNED - 64)) | (1L << (UPDATE - 64)) | (1L << (USE - 64)) | (1L << (USING - 64)) | (1L << (VALUES - 64)) | (1L << (VARBINARY - 64)) | (1L << (VARCHAR - 64)) | (1L << (YEAR - 64)) | (1L << (ZEROFILL - 64)) | (1L << (ID - 64)))) != 0)) {
					{
					setState(489); index_name();
					}
				}

				setState(492); parNameList();
				setState(496);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,74,_ctx);
				while ( _alt!=2 && _alt!=-1 ) {
					if ( _alt==1 ) {
						{
						{
						setState(493); index_option();
						}
						} 
					}
					setState(498);
					_errHandler.sync(this);
					_alt = getInterpreter().adaptivePredict(_input,74,_ctx);
				}
				}
				break;

			case 5:
				_localctx = new ForeignContext(_localctx);
				enterOuterAlt(_localctx, 5);
				{
				setState(500);
				_la = _input.LA(1);
				if (_la==CONSTRAINT) {
					{
					setState(499); match(CONSTRAINT);
					}
				}

				setState(503);
				switch ( getInterpreter().adaptivePredict(_input,76,_ctx) ) {
				case 1:
					{
					setState(502); constr_name();
					}
					break;
				}
				setState(505); match(FOREIGN);
				setState(506); match(KEY);
				setState(508);
				_la = _input.LA(1);
				if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << STRING_G) | (1L << STRING_Q) | (1L << STRING_D) | (1L << QO) | (1L << DQ) | (1L << GR) | (1L << ACTION) | (1L << ADD) | (1L << ALTER) | (1L << ASC) | (1L << AUTO_INC) | (1L << BIGINT) | (1L << BINARY) | (1L << BIT) | (1L << BTREE) | (1L << CASCADE) | (1L << CHARACTER) | (1L << CHAR) | (1L << CHECK) | (1L << COLLATE) | (1L << COL_FORMAT) | (1L << COMMIT) | (1L << CREATE) | (1L << DATABASE) | (1L << DECIMAL) | (1L << DELETE) | (1L << DESC) | (1L << DISK) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << END) | (1L << ENUM) | (1L << EXISTS) | (1L << FIXED) | (1L << FOREIGN))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (FULLTEXT - 64)) | (1L << (FUNCTION - 64)) | (1L << (HASH - 64)) | (1L << (IF - 64)) | (1L << (IGNORE - 64)) | (1L << (INSERT - 64)) | (1L << (INTEGER - 64)) | (1L << (INTO - 64)) | (1L << (IS - 64)) | (1L << (NUMERIC - 64)) | (1L << (REAL - 64)) | (1L << (REFERENCES - 64)) | (1L << (REPLACE - 64)) | (1L << (RESTRICT - 64)) | (1L << (SCHEMA - 64)) | (1L << (SET - 64)) | (1L << (SMALLINT - 64)) | (1L << (SPATIAL - 64)) | (1L << (STORAGE - 64)) | (1L << (TABLE - 64)) | (1L << (TEMPORARY - 64)) | (1L << (UNSIGNED - 64)) | (1L << (UPDATE - 64)) | (1L << (USE - 64)) | (1L << (USING - 64)) | (1L << (VALUES - 64)) | (1L << (VARBINARY - 64)) | (1L << (VARCHAR - 64)) | (1L << (YEAR - 64)) | (1L << (ZEROFILL - 64)) | (1L << (ID - 64)))) != 0)) {
					{
					setState(507); index_name();
					}
				}

				setState(510); parNameList();
				setState(511); reference_definition();
				}
				break;

			case 6:
				_localctx = new CheckContext(_localctx);
				enterOuterAlt(_localctx, 6);
				{
				setState(513); match(CONSTRAINT);
				setState(514); constr_name();
				setState(515); match(CHECK);
				setState(516); consume_par();
				}
				break;

			case 7:
				_localctx = new ReferenceContext(_localctx);
				enterOuterAlt(_localctx, 7);
				{
				setState(518); reference_definition();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}