# Copyright (C) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2013, Monty Program Ab. # Use is subject to license terms. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA # # This grammar is a slightly modified version of engine_stress.yy, # suitable for Galera testing #insert_replace | update | delete | drop_create_table | drop_create_table | replace | ischema | ischema | ischema | alter | #insert_replace | update | delete | replace | ischema | ischema | ischema | drop_create_table | drop_create_table | fk | # query: insert_replace | update | delete | replace | replace | select | transaction | drop_create_table | fktable | fktable | fktable | fktable | fktable; ischema: SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX ; replace: REPLACE INTO _table ( _field_no_pk ) VALUES ( value ) ; transaction: START TRANSACTION | COMMIT ; SET TRANSACTION ISOLATION LEVEL isolation_level | ROLLBACK ; SET TRANSACTION ISOLATION LEVEL isolation_level | SAVEPOINT A | ROLLBACK TO SAVEPOINT A | SET AUTOCOMMIT=OFF | SET AUTOCOMMIT=ON ; isolation_level: READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE ; select: SELECT select_list FROM join_list where order_by LIMIT large_digit; select_list: X . _field_key | X . _field_key | X . `pk` | X . _field | X. _field | X. _field null | X. _field op X. _field | X._field sign X._field | select_list, X._field | * ; null: IS NULL | IS NOT NULL ; op: + | / | DIV ; sign: < | > | = | >= | <= | <> | != ; # Use index for all joins join_list: _table AS X | _table AS X LEFT JOIN _table AS Y USING ( _field_key ); # Insert more than we delete insert_replace: i_r INTO _table (`pk`) VALUES (value) | i_r INTO _table ( _field_no_pk , _field_next ) VALUES ( value , value ) , ( value , value ) | i_r INTO _table ( `pk` , _field_nokey ) VALUES ( value , value ) , ( value , value ) | i_r INTO _table ( _field_no_pk ) SELECT _field_key FROM _table AS X where ORDER BY _field_list LIMIT large_digit; i_r: INSERT ignore | REPLACE; ignore: |; update: UPDATE ignore _table AS X SET _field_no_pk = value where ORDER BY _field_list LIMIT large_digit ; # We use a smaller limit on DELETE so that we delete less than we insert delete: DELETE ignore FROM _table where_delete ORDER BY _field_list LIMIT small_digit ; order_by: | ORDER BY X . _field_key ; # Use an index at all times where: | WHERE X . _field_key < value | # Use only < to reduce deadlocks WHERE X . _field_key IN ( value , value , value , value , value ) | WHERE X . _field_key BETWEEN small_digit AND large_digit | WHERE X . _field_key BETWEEN _tinyint_unsigned AND _int_unsigned; drop_create_table: DROP TABLE IF EXISTS _letter[invariant] ; CREATE TABLE _letter[invariant] LIKE _table[invariant] ; INSERT INTO _letter[invariant] SELECT * FROM _table[invariant] | DROP TABLE IF EXISTS _letter[invariant] ; CREATE TABLE _letter[invariant] LIKE _table[invariant] ; INSERT INTO _letter[invariant] SELECT * FROM _table[invariant] ; DROP TABLE _table[invariant] ; ALTER TABLE _letter[invariant] RENAME _table[invariant] ; fktable: DROP TABLE IF EXISTS _letter[invariant] ; CREATE TABLE _letter[invariant] LIKE _table[invariant] ; INSERT INTO _letter[invariant] SELECT * FROM _table[invariant]; ALTER TABLE _letter[invariant] ADD CONSTRAINT FOREIGN KEY (_field_indexed) REFERENCES _table[invariant] (_field_key) nothing_delete_update; DROP TABLE _table[invariant] ; ALTER TABLE _letter[invariant] RENAME _table[invariant]; DROP TABLE _table[invariant]; nothing_delete_update: # nothing specified -> the default action is RESTRICT. | ON DELETE reference_option | ON DELETE reference_option | ON UPDATE reference_option | ON UPDATE reference_option | ON DELETE reference_option ON UPDATE reference_option | ON UPDATE reference_option ON DELETE reference_option ; reference_option: RESTRICT | CASCADE | SET NULL | NO ACTION ; #temp: #| | | | | | TEMPORARY; where_delete: | WHERE _field_key = value | WHERE _field_key IN ( value , value , value , value , value ) | WHERE _field_key BETWEEN small_digit AND large_digit ; large_digit: 5 | 6 | 7 | 8 ; small_digit: 1 | 2 | 3 | 4 ; value: _digit | _tinyint_unsigned | _varchar(1) | _int_unsigned ; zero_one: 0 | 0 | 1; type: INT | DECIMAL | FLOAT | BIT | CHAR( _digit ) | VARCHAR ( _digit ); null_default_or_not: | | | | NULL DEFAULT NULL | NOT NULL DEFAULT 0 ; after_or_not: | | AFTER _field | FIRST ; alter: ALTER TABLE _table MODIFY _field_no_key type null_default_or_not after_or_not | ALTER TABLE _table MODIFY _field_key type NOT NULL DEFAULT 0 after_or_not ;