Problem
The output of "show create trigger" does not include the "follows" keyword defined in the create trigger statement.
Reproduce
create database if not exists test;
|
|
use test
|
|
create table table_a (id int(10) not null,
|
value varchar(20) not null,
|
created datetime(6),
|
updated datetime(6)
|
);
|
|
create table table_a_audit(id int(10) not null,
|
ts datetime(6),
|
old_value varchar(20),
|
new_value varchar(20)
|
);
|
|
delimiter $$
|
create or replace trigger table_a_trig_1
|
before insert on table_a
|
for each row
|
begin
|
set new.created = current_timestamp(6);
|
set new.updated = current_timestamp(6);
|
end$$
|
|
create or replace trigger table_a_trig_2
|
before insert on table_a
|
for each row
|
follows table_a_trig_1
|
begin
|
insert into table_a_audit (id, ts, new_value)
|
value (new.id, current_timestamp(6), new.value);
|
end$$
|
|
delimiter ;
|
|
insert into table_a (id, value) values (1, "foo");
|
commit;
|
|
select * from table_a;
|
|
select * from table_a_audit;
|
|
show create table table_a;
|
|
show create trigger table_a_trig_1;
|
|
show create trigger table_a_trig_2;
|
The output of this last statement is incorrect, in build-11611 on bb-10.2-compatibility branch you get the following output
MariaDB [test]> show create trigger table_a_trig_2;
|
+----------------+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+------------------------+
|
| Trigger | sql_mode | SQL Original Statement | character_set_client | collation_connection | Database Collation | Created |
|
+----------------+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+------------------------+
|
| table_a_trig_2 | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | CREATE DEFINER=`root`@`localhost` trigger table_a_trig_2
|
before insert on table_a
|
for each row
|
begin
|
insert into table_a_audit (id, ts, new_value)
|
value (new.id, current_timestamp(6), new.value);
|
end | latin1 | latin1_swedish_ci | latin1_swedish_ci | 2016-10-11 17:29:58.31 |
|
+----------------+--------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+------------------------+
|
1 row in set (0.00 sec)
|
Solution
The :show create trigger" should include the full trigger definition.
- relates to
-
MDEV-6112
multiple triggers per table
-
-
Closed
{"report":{"fcp":898.9000000953674,"ttfb":174.90000009536743,"pageVisibility":"visible","entityId":58437,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"f56cfaf3-a5bb-439d-9dee-bd27c67d3fb8","navigationType":0,"readyForUser":963.4000000953674,"redirectCount":0,"resourceLoadedEnd":1143,"resourceLoadedStart":180.79999995231628,"resourceTiming":[{"duration":283,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":180.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":180.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":463.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":282.7999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":181.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":463.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":292,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":181.20000004768372,"connectEnd":181.20000004768372,"connectStart":181.20000004768372,"domainLookupEnd":181.20000004768372,"domainLookupStart":181.20000004768372,"fetchStart":181.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":181.20000004768372,"responseEnd":473.2000000476837,"responseStart":473.2000000476837,"secureConnectionStart":181.20000004768372},{"duration":320.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":181.29999995231628,"connectEnd":181.29999995231628,"connectStart":181.29999995231628,"domainLookupEnd":181.29999995231628,"domainLookupStart":181.29999995231628,"fetchStart":181.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":181.29999995231628,"responseEnd":501.40000009536743,"responseStart":501.40000009536743,"secureConnectionStart":181.29999995231628},{"duration":316.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":181.29999995231628,"connectEnd":181.29999995231628,"connectStart":181.29999995231628,"domainLookupEnd":181.29999995231628,"domainLookupStart":181.29999995231628,"fetchStart":181.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":181.29999995231628,"responseEnd":497.7999999523163,"responseStart":497.7999999523163,"secureConnectionStart":181.29999995231628},{"duration":320.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":181.40000009536743,"connectEnd":181.40000009536743,"connectStart":181.40000009536743,"domainLookupEnd":181.40000009536743,"domainLookupStart":181.40000009536743,"fetchStart":181.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":181.40000009536743,"responseEnd":501.7999999523163,"responseStart":501.7999999523163,"secureConnectionStart":181.40000009536743},{"duration":320.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":181.5,"connectEnd":181.5,"connectStart":181.5,"domainLookupEnd":181.5,"domainLookupStart":181.5,"fetchStart":181.5,"redirectEnd":0,"redirectStart":0,"requestStart":181.5,"responseEnd":502.10000014305115,"responseStart":502.10000014305115,"secureConnectionStart":181.5},{"duration":321.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":181.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":502.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":320.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":181.70000004768372,"connectEnd":181.70000004768372,"connectStart":181.70000004768372,"domainLookupEnd":181.70000004768372,"domainLookupStart":181.70000004768372,"fetchStart":181.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":181.70000004768372,"responseEnd":502.5,"responseStart":502.5,"secureConnectionStart":181.70000004768372},{"duration":321.10000014305115,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":181.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":502.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":321,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":182,"connectEnd":182,"connectStart":182,"domainLookupEnd":182,"domainLookupStart":182,"fetchStart":182,"redirectEnd":0,"redirectStart":0,"requestStart":182,"responseEnd":503,"responseStart":503,"secureConnectionStart":182},{"duration":645.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":182.70000004768372,"connectEnd":182.70000004768372,"connectStart":182.70000004768372,"domainLookupEnd":182.70000004768372,"domainLookupStart":182.70000004768372,"fetchStart":182.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":182.70000004768372,"responseEnd":828.5,"responseStart":828.5,"secureConnectionStart":182.70000004768372},{"duration":960.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":182.70000004768372,"connectEnd":182.70000004768372,"connectStart":182.70000004768372,"domainLookupEnd":182.70000004768372,"domainLookupStart":182.70000004768372,"fetchStart":182.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":182.70000004768372,"responseEnd":1143,"responseStart":1143,"secureConnectionStart":182.70000004768372},{"duration":439.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":702.7999999523163,"connectEnd":702.7999999523163,"connectStart":702.7999999523163,"domainLookupEnd":702.7999999523163,"domainLookupStart":702.7999999523163,"fetchStart":702.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":702.7999999523163,"responseEnd":1142.6000001430511,"responseStart":1142.6000001430511,"secureConnectionStart":702.7999999523163}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":42,"responseStart":174,"responseEnd":179,"domLoading":177,"domInteractive":1163,"domContentLoadedEventStart":1163,"domContentLoadedEventEnd":1198,"domComplete":2156,"loadEventStart":2156,"loadEventEnd":2157,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1152.6000001430511},{"name":"bigPipe.sidebar-id.end","time":1153.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1153.6000001430511},{"name":"bigPipe.activity-panel-pipe-id.end","time":1155.9000000953674},{"name":"activityTabFullyLoaded","time":1206.2000000476837}],"measures":[],"correlationId":"3df0ea7f7171d1","effectiveType":"4g","downlink":9.7,"rtt":0,"serverDuration":70,"dbReadsTimeInMs":10,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}