Код: Выделить всё
alter table tbl_address
add column location POINT GENERATED ALWAYS AS (ST_SRID(POINT(longitude, latitude), 4326)) STORED NOT NULL;
Код: Выделить всё
CREATE SPATIAL INDEX idx_location ON tbl_address (location);
0 row(s) affected, 1 warning(s): 3674 The spatial index on column 'location' will not be used by the query optimizer since the column does not have an SRID attribute. Consider adding an SRID attribute to the column. Records: 0 Duplicates: 0 Warnings: 1
Как мне заставить это работать? Было бы здорово обновлять местоположение при изменении долготы/широты. Действительно ли мне нужно реализовать триггер? Я использую MySQL 8.
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/798 ... -attribute
Мобильная версия