go-randgen icon indicating copy to clipboard operation
go-randgen copied to clipboard

_field selects non-existing columns in a table

Open zhangysh1995 opened this issue 5 years ago • 2 comments

t2 doesn't have an a column, but ais selected in the generated SQLs:

mysql> desc t1;
+-------+---------+------+------+---------+-------+
| Field | Type    | Null | Key  | Default | Extra |
+-------+---------+------+------+---------+-------+
| a     | int(11) | YES  |      | NULL    |       |
+-------+---------+------+------+---------+-------+
1 row in set (0.00 sec)

mysql> desc t2;
+-------+---------+------+------+---------+-------+
| Field | Type    | Null | Key  | Default | Extra |
+-------+---------+------+------+---------+-------+
| b     | int(11) | YES  |      | NULL    |       |
+-------+---------+------+------+---------+-------+
1 row in set (0.00 sec)

--- SELECT `a` FROM t2; // wrong
--- SELECT `a` FROM t1 WHERE `a` > 7; // correct

zhangysh1995 avatar Jul 10 '20 13:07 zhangysh1995

Could you please attach your yy and zz file?

cyliu0 avatar Aug 31 '20 09:08 cyliu0

I think the reason was the same as in #25. It assumes t2 has the same scheme as t1.

zhangysh1995 avatar Aug 31 '20 10:08 zhangysh1995