Bug #76414 need a current_trx_id information function

Submitted: 20 Mar 2015 20:52
Reporter: Trey Raymond Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: functions, information

[20 Mar 2015 20:52] Trey Raymond
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...

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.064 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.