1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-32022 ERROR 1054 (42S22): Unknown column 'X' in 'NEW' in trigger

add missing do_get_copy/do_build_clone
This commit is contained in:
Sergei Golubchik
2024-10-22 19:14:35 +02:00
parent 83db978271
commit eac33a23da
4 changed files with 24 additions and 2 deletions

View File

@ -2448,6 +2448,14 @@ SELECT * FROM t1;
a b total
10 20 30
DROP TABLE t1;
#
# End of 10.3 tests
#
# MDEV-32022 ERROR 1054 (42S22): Unknown column 'X' in 'NEW' in trigger
#
create table t1 (m set('sms') not null);
create table t2 (i int);
create table t3 (j int);
create trigger t1 after insert on t1 for each row insert ignore into t2 select t3.j from t3 join (select 'sms' as method) m on find_in_set(m.method, new.m);
insert into t1 values ('sms');
drop table t1, t2, t3;
# End of 10.5 tests

View File

@ -2784,6 +2784,16 @@ INSERT INTO t1 (a,b) VALUES (10, 20);
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
--echo # MDEV-32022 ERROR 1054 (42S22): Unknown column 'X' in 'NEW' in trigger
--echo #
create table t1 (m set('sms') not null);
create table t2 (i int);
create table t3 (j int);
create trigger t1 after insert on t1 for each row insert ignore into t2 select t3.j from t3 join (select 'sms' as method) m on find_in_set(m.method, new.m);
insert into t1 values ('sms');
drop table t1, t2, t3;
--echo # End of 10.5 tests

View File

@ -7871,6 +7871,7 @@ static
Item *find_producing_item(Item *item, st_select_lex *sel)
{
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
item->type() == Item::TRIGGER_FIELD_ITEM ||
(item->type() == Item::REF_ITEM &&
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
Item_field *field_item= NULL;

View File

@ -6947,6 +6947,9 @@ public:
Item *copy_or_same(THD *) override { return this; }
Item *get_tmp_table_item(THD *thd) override { return copy_or_same(thd); }
void cleanup() override;
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_trigger_field>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
private:
void set_required_privilege(bool rw) override;