Fixed that SHOW CREATE TABLE for sequences shows used table options

This commit is contained in:
Monty 2024-10-14 15:12:02 +03:00
parent 2c52fdd28a
commit 0de2613e7a
5 changed files with 60 additions and 1 deletions

View File

@ -724,3 +724,34 @@ ERROR HY000: Sequence 'test.s' table structure is invalid (Wrong number of colum
#
# End of 10.4 test
#
#
# Ensure that SHOW CREATE TABLE shows used table options
#
SET @@innodb_compression_default=ON;
CREATE TABLE seq (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) engine=innodb,sequence=1;
show create sequence seq;
Table Create Table
seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB `PAGE_COMPRESSED`='ON'
show create table seq;
Table Create Table
seq CREATE TABLE `seq` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) ENGINE=InnoDB SEQUENCE=1 `PAGE_COMPRESSED`='ON'
drop sequence seq;
SET @@innodb_compression_default=DEFAULT;

View File

@ -565,3 +565,23 @@ create table s sequence=1 as select 1;
--echo #
--echo # End of 10.4 test
--echo #
--echo #
--echo # Ensure that SHOW CREATE TABLE shows used table options
--echo #
SET @@innodb_compression_default=ON;
CREATE TABLE seq (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) engine=innodb,sequence=1;
show create sequence seq;
show create table seq;
drop sequence seq;
SET @@innodb_compression_default=DEFAULT;

View File

@ -65,6 +65,8 @@ public:
ha_sequence(handlerton *hton, TABLE_SHARE *share);
~ha_sequence();
virtual handlerton *storage_ht() const override
{ return file->ht; }
/* virtual function that are re-implemented for sequence */
int open(const char *name, int mode, uint test_if_locked) override;

View File

@ -4987,6 +4987,12 @@ public:
/* XXX to be removed, see ha_partition::partition_ht() */
virtual handlerton *partition_ht() const
{ return ht; }
/*
Used with 'wrapper' engines, like SEQUENCE, to access to the
underlaying engine used for storage.
*/
virtual handlerton *storage_ht() const
{ return ht; }
inline int ha_write_tmp_row(uchar *buf);
inline int ha_delete_tmp_row(uchar *buf);
inline int ha_update_tmp_row(const uchar * old_data, uchar * new_data);

View File

@ -1838,7 +1838,7 @@ static void add_table_options(THD *thd, TABLE *table,
hton= table->part_info->default_engine_type;
else
#endif
hton= table->file->ht;
hton= table->file->storage_ht();
bzero((char*) &create_info, sizeof(create_info));
/* Allow update_create_info to update row type, page checksums and options */