1
0
mirror of https://github.com/MariaDB/server.git synced 2025-05-02 19:25:03 +03:00
unknown a914b5274f Save and clear run context before executing a stored function or trigger and restore it afterwards.
This allows us to use statement replication with functions and triggers
The following things are fixed with this patch:
- NOW() and automatic timestamps takes the value from the main event for functions and triggers (which allows these to replicate with statement level logging)
- No side effects for triggers or functions with auto-increment values(), last_insert_id(), rand() or found_rows()
- Triggers can't return result sets

Fixes bugs:
#12480: NOW() is not constant in a trigger
#12481: Using NOW() in a stored function breaks statement based replication
#12482: Triggers has side effects with auto_increment values
#11587: trigger causes lost connection error


mysql-test/r/trigger.result:
  Added test fpr big
mysql-test/t/sp-error.test:
  Changed error message numbers
mysql-test/t/trigger.test:
  Added test for trigger returning result (#11587)
sql/item_func.cc:
  Store the first used seed value for RAND() value.
  (This makes rand() replicatable in functions and triggers)
  Save and clear run context before executing a stored function and restore it afterwards.
  This removes side effects of stored functions for RAND(), auto-increment values and NOW() and makes most stored function replicatable
sql/share/errmsg.txt:
  Reuse error message also for triggers
sql/sp_head.cc:
  If in function or trigger, don't change value of NOW()
  (This allows us to use statement replication with functions that directly or indirectly uses timestamps)
sql/sql_class.cc:
  Added framework for storing and retrieving run context while exceuting triggers or stored functions.
sql/sql_class.h:
  Added framework for storing and retrieving run context while exceuting triggers or stored functions.
sql/sql_parse.cc:
  If in function or trigger, don't change value of NOW()
  (This allows us to use statement replication with functions that directly or indirectly uses timestamps)
sql/sql_trigger.cc:
  Moved process_triggers function from sql_trigger.h
  Use reset/restore sub_statement_state while executing triggers to avoid side effects and make them replicatable
sql/sql_trigger.h:
  Moved process_triggers function from sql_trigger.h
  Use reset/restore sub_statement_state while executing triggers to avoid side effects and make them replicatable
sql/sql_yacc.yy:
  Give error message if trigger can return a result set (Bug #11587)
tests/fork_big2.pl:
  Removed return from end of lines
mysql-test/r/rpl_trigger.result:
  New BitKeeper file ``mysql-test/r/rpl_trigger.result''
mysql-test/t/rpl_trigger.test:
  New BitKeeper file ``mysql-test/t/rpl_trigger.test''
2005-08-15 18:15:12 +03:00
..
2005-06-03 17:13:43 +02:00
2005-06-16 10:09:05 +02:00
2005-08-11 18:42:22 +01:00
2005-06-23 19:05:36 +02:00
2005-06-15 08:39:00 -07:00
2005-06-27 12:25:15 +02:00
2005-08-02 14:27:52 +05:00
2005-04-11 15:11:52 +05:00
2005-07-06 17:16:22 +05:00
2005-07-22 21:06:02 +05:00
2005-07-06 17:16:22 +05:00
2005-02-22 15:47:00 +02:00
2005-08-07 21:30:46 +00:00
2005-08-02 12:09:49 -07:00
2005-06-27 20:31:00 +03:00
2005-07-28 21:28:20 -07:00
2005-07-28 21:39:24 +03:00
2005-06-13 11:45:29 -07:00
2005-07-16 18:06:34 -07:00
2005-04-05 19:45:34 -07:00
2005-03-23 19:18:25 +01:00
2005-05-18 13:54:36 -07:00
2005-08-08 19:04:11 +05:00
2005-08-07 22:10:05 +00:00
2005-05-05 10:36:17 -07:00
2005-07-22 21:06:02 +05:00
2005-07-03 14:17:52 +03:00
2005-08-05 16:43:35 -07:00
2005-04-11 22:36:07 +02:00
2005-04-05 19:45:34 -07:00
2005-05-24 15:52:48 +01:00
2005-05-18 13:54:36 -07:00
2005-07-30 09:24:51 +03:00
2005-07-12 11:49:57 +02:00
2005-05-19 20:38:48 +02:00
2005-07-26 09:06:37 +02:00
2005-05-04 10:16:03 +02:00
2005-04-01 22:14:30 +02:00
2005-04-21 10:59:21 +02:00
2005-07-19 03:01:25 +04:00
2005-04-01 00:03:26 +05:00
2005-04-05 19:45:34 -07:00
2005-05-14 16:24:36 +03:00
2005-07-28 21:39:24 +03:00
2005-08-11 18:42:22 +01:00
2005-07-16 08:19:20 -07:00
2005-04-05 19:45:34 -07:00
2005-03-16 04:32:47 +03:00
2005-06-17 14:03:27 +02:00
2005-07-28 21:25:05 +03:00
2005-02-24 17:25:06 +01:00
2005-07-19 03:01:25 +04:00
2005-01-31 13:18:36 +00:00
2005-04-06 18:19:05 +02:00
2005-07-19 03:01:25 +04:00
2005-03-23 19:18:25 +01:00
2005-03-01 14:50:59 +02:00
2005-07-27 15:57:00 +05:00
2005-03-16 15:26:07 +02:00
2005-03-03 15:01:46 -08:00
2005-05-07 08:25:58 -07:00
2005-07-01 15:07:06 +05:00
2005-02-05 08:54:13 -08:00
2005-08-11 18:42:22 +01:00
2005-02-28 12:18:39 +02:00
2005-05-28 01:28:18 +02:00
2005-05-02 11:45:06 -07:00
2005-08-12 01:27:04 -07:00
2005-06-07 05:43:59 +03:00
2005-04-04 00:50:05 +02:00