[MDEV-10151] Cannot create trigger through procedure Created: 2016-05-30 Updated: 2017-01-15 Resolved: 2017-01-15 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Procedure, Documentation, Triggers |
| Affects Version/s: | N/A |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | ManasaTulluri | Assignee: | Ian Gilfillan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux x01bedocdb2a 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux |
||
| Comments |
| Comment by ManasaTulluri [ 2016-05-30 ] |
|
Hi, We are currently migrating from oracle to mariadb. We have around 100 tables , each having date columns and associated before insert triggers to populate current_timestamp into the date columns. I have written a procedure to generate the trigger DDL , which takes database name and table name as input Procedure is able to generate the Trigger DDL accurately but is not able to execute the same using prepare statement(Dynamic SQL) as shown below PREPARE q from v_trigger_ddl; But if I execute the same trigger DDL generated by procedure manually on the command prompt, it executes without any errors. Please help me If I am missing anything , as it will reduce the manual effort if the procedure executes the DDL as well. |
| Comment by Elena Stepanova [ 2016-05-30 ] |
|
You really can't, it's not supported and is not a bug.
and MariaDB documentation is a little more vague:
and https://mariadb.com/kb/en/mariadb/prepare-statement/ for the list of statements supported in PS. "Many SQL not permitted" is not specific enough, maybe the wording needs to be improved, assigning to greenman for this. |
| Comment by ManasaTulluri [ 2016-05-30 ] |
|
Ok thank you |
| Comment by Elena Stepanova [ 2016-05-30 ] |
|
First that comes to mind is to redirect the generated statements to a file, and then feed the resulting SQL file to the client. |
| Comment by ManasaTulluri [ 2016-05-31 ] |
|
Yes I got the same idea...But then I am creating another procedure to which I will input all the table names and call the first procedure in a loop. Now the problem is, I am not able to append all the triggers DDL to the same file using using INTO OUTFILE. There is a limitation to INTO OUTFILE (It can only open a new file). So is there any other way I can re-route all the DDL by appending to the same file??? |
| Comment by Ian Gilfillan [ 2017-01-15 ] |
|
This has been clarified in the documentation. |