Commit d569e6de authored by Nikita Malyavin's avatar Nikita Malyavin

MDEV-29169 Using MATCH returns NULL for Virtual Column

Virtual column values are updated in handler in reading commands,
like ha_index_next, etc. This was missing for ha_ft_read.

handler::ha_ft_read: add table->update_virtual_fields() call
parent f0820400
......@@ -278,3 +278,20 @@ ALTER TABLE t1 ADD d INT NULL;
ALTER TABLE t1 ADD FULLTEXT(b);
ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index
DROP TABLE t1;
#
# MDEV-29169 Using MATCH returns NULL for Virtual Column
#
CREATE TABLE t (a TEXT DEFAULT NULL,
b TEXT AS (a),
c TEXT AS (concat(a, '1')),
d int AS (111) VIRTUAL,
FULLTEXT KEY `a` (`a`)
) ENGINE=InnoDB;
INSERT INTO t (a) VALUES ('test');
SELECT * FROM t;
a b c d
test test test1 111
SELECT * FROM t WHERE MATCH(a) AGAINST('test');
a b c d
test test test1 111
DROP TABLE t;
......@@ -268,3 +268,19 @@ ALTER TABLE t1 ADD d INT NULL;
--error ER_INNODB_FT_WRONG_DOCID_INDEX
ALTER TABLE t1 ADD FULLTEXT(b);
DROP TABLE t1;
--echo #
--echo # MDEV-29169 Using MATCH returns NULL for Virtual Column
--echo #
CREATE TABLE t (a TEXT DEFAULT NULL,
b TEXT AS (a),
c TEXT AS (concat(a, '1')),
d int AS (111) VIRTUAL,
FULLTEXT KEY `a` (`a`)
) ENGINE=InnoDB;
INSERT INTO t (a) VALUES ('test');
SELECT * FROM t;
SELECT * FROM t WHERE MATCH(a) AGAINST('test');
DROP TABLE t;
......@@ -6513,8 +6513,13 @@ inline int handler::ha_ft_read(uchar *buf)
{
int error= ft_read(buf);
if (!error)
{
update_rows_read();
if (table->vfield && buf == table->record[0])
table->update_virtual_fields(this, VCOL_UPDATE_FOR_READ);
}
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment