Description:
the CONNECTION_ID() function gives the current connection id, but there's no way to get a the current transaction id from within a set of queries. would primarily be used by triggers, but it's a nice to have in many cases. currently, querying innodb_trx is a sloppy workaround that involves a lot more work for the server, and also that table isn't 100% in sync, so there is the potential for data loss.
How to repeat:
start transaction;
-- execute any query here, info_schema doesn't have the trx id until something is run
select trx_id from information_schema.innodb_trx where trx_mysql_thread_id=connection_id();
Suggested fix:
add the function...