[MDEV-5794] Triggers can't see DEFAULT values Created: 2014-03-05 Updated: 2015-10-31 Due: 2014-03-19 Resolved: 2014-03-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.1.67, 5.2.14, 5.3.12, 5.5.36, 10.0.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Federico Razzoli | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | upstream | ||
| Description |
|
I spoke about this in the list moths ago, but I forgot to file a bug. Try the following code:
I get no errors, but t.a is NULL (which would be ok if a.t had no default value). Since I'm not sure about the syntax, I tried DEFAULT(a) and DEFAULT(t.a), but in both cases I got an error. I have no idea if the errors are expected or not, but as far as I understand the syntax in the example should work. |
| Comments |
| Comment by Elena Stepanova [ 2014-03-05 ] | |||||||||||||||||||||||||||||||||||||||
|
Hi Federico, I think it is more about BEFORE than about TRIGGER:
So, it might have something to do with not having the information in a before trigger, although I haven't found anything about it in the documentation.
The worklog itself is not public, so it's hard to understand why it was done, maybe the problem you described was one of the reasons. So, undoubtedly, MySQL won't do anything about it in 5.5. Do you agree, or do you want a further analysis? | |||||||||||||||||||||||||||||||||||||||
| Comment by Federico Razzoli [ 2014-03-05 ] | |||||||||||||||||||||||||||||||||||||||
|
Hi elenst, thank you for the useful information. I feel bad if a new limitation will be added to the stored programs, which already have many limitations. But in this particular case, DEFAULT already does not work at least in BEFORE INSERT, and after all it's just a cleaner way to do something I could do without the DEFAULT keyword. So, don't mind too much about this bug. | |||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-03-05 ] | |||||||||||||||||||||||||||||||||||||||
|
OK, thanks. | |||||||||||||||||||||||||||||||||||||||
| Comment by Federico Razzoli [ 2015-10-31 ] | |||||||||||||||||||||||||||||||||||||||
|
I retried this to check if something changed - it didn't. However, shouldn't MariaDB return an error/warning to inform us that we are trying to do something that will not work? |