mariadb/mysql-test/suite/compat/oracle/t/keywords.test
Alexander Barkov 5352e9687a MDEV-17363 - Compressed columns cannot be restored from dump
In collaboration with Sergey Vojtovich <svoj@mariadb.org>

The COMPRESSED clause is now a part of the data type and goes immediately
after the data type and length, but before the CHARACTER SET clause,
and before column attributes such as DEFAULT, COLLATE, ON UPDATE,
SYSTEM VERSIONING, engine specific column attributes.

In the old reduction, the COMPRESSED clause was a column attribute.

New syntax:
  <varchar or text data type> <length> <compression> <character set> <column attributes>
  <varbinary or blob data type> <length> <compression> <column attributes>

New syntax examples:
  VARCHAR(1000) COMPRESSED CHARACTER SET latin1 DEFAULT ''
  BLOB COMPRESSED DEFAULT ''

Deprecate syntax examples:
  VARCHAR(1000) CHARACTER SET latin1 COMPRESSED DEFAULT ''
  TEXT          CHARACTER SET latin1 DEFAULT '' COMPRESSED
  VARBINARY(1000) DEFAULT '' COMPRESSED

As a side effect:
- COMPRESSED is not valid as an SP label name in SQL/PSM routines any more
  (but it's still valid as an SP label name in sql_mode=ORACLE)

- COMPRESSED is now allowed in combination with GENERATED ALWAYS AS:

  TEXT COMPRESSED GENERATED ALWAYS AS REPEAT('a',1000)
2019-06-18 07:48:08 +04:00

29 lines
498 B
Text

SET sql_mode=ORACLE;
--echo #
--echo # MDEV-17363 Compressed columns cannot be restored from dump
--echo # In sql_mode=ORACLE, COMPRESSED is still valid both as an SP label
--echo # and an SP variable name.
--echo #
DELIMITER $$;
BEGIN
IF TRUE THEN
GOTO compressed;
END IF;
SELECT 'This should not be reached' AS warn;
<<compressed>>
BEGIN
SELECT 1 AS a;
END;
END
$$
DELIMITER ;$$
DELIMITER $$;
DECLARE compressed INT DEFAULT 1;
BEGIN
SELECT compressed;
END
$$
DELIMITER ;$$