News for hackers. Stuff that matters.
Re:Migrating Facebook to MySQL 8.0 by ipaddr on Thursday July 22, 2021 @07:45PM (#27925697)
Why would alphabetically be better? Wouldn't you want first in first out?
Re:Migrating Facebook to MySQL 8.0 by setr on Friday July 23, 2021 @01:25AM (#27927516)
Alphabetical makes it so two databases with the same triggers have the same behavior. FIFO breaks that, because now it depends on trigger construction order (eg when dump/restoring) and is totally invisible to the user.

Additionally, modifying a trigger by drop/creating it would change behavior, unless you also drop/create every trigger (in the original order)

Re:Migrating Facebook to MySQL 8.0 by ipaddr on Friday July 23, 2021 @03:52AM (#27928283)
Thank you most important thing I learned today.
Re:Migrating Facebook to MySQL 8.0 by zaphirplane on Saturday July 24, 2021 @12:30AM (#27938407)
What is an example where the order of execution is required, not contrived or bad practise. Looking for a good use case
Re:Migrating Facebook to MySQL 8.0 by setr on Saturday July 24, 2021 @01:52AM (#27938801)
Easiest I can imagine is a user-facing id that gets incremented by trigger (e.g. select max(col)+1 — autoincrement/serial doesn’t guarantee contiguity, or even reasonable increments…).

And then any second trigger that relies on that value

Re:Migrating Facebook to MySQL 8.0 by paulddraper on Saturday July 24, 2021 @11:24AM (#27941701)
Oh, I think it's probably bad practice to knowingly depend on that.

But I also think that it's unnecessarily problematic to make the order non-deterministic.

Re:Migrating Facebook to MySQL 8.0 by Pamar on Friday July 23, 2021 @06:05AM (#27929012)
Not only what @setr answered but consider also that by having a consistent ruling you can actually design or alter the order of triggers just by naming them according to a specific scheme.

It just makes easier to understand what happens when triggers are invoked, without having to actually force specific cases by direct experimentation.

I did not even know that the standard prescribed a FIFO order, looks like a pretty bad idea to me, actually.

Re:Migrating Facebook to MySQL 8.0 by jolux on Thursday July 22, 2021 @07:51PM (#27925754)
It means that the order they fire is imperative and determined by how you run your migrations.
Re:Migrating Facebook to MySQL 8.0 by paulddraper on Thursday July 22, 2021 @10:09PM (#27926479)
The problem is that it doesn't leave you a great way to adjust order. It's just kinda weird.

(To be fair, table columns share this characteristic.)

Re:Migrating Facebook to MySQL 8.0 by marcosdumay on Thursday July 22, 2021 @10:40PM (#27926605)
> To be fair, table columns share this characteristic.

The table columns order is meaningless, but the triggers order is very relevant.

Re:Migrating Facebook to MySQL 8.0 by paulddraper on Saturday July 24, 2021 @11:26AM (#27941718)
Table column order is not meaningless.

``` INSERT INTO foo SELECT * FROM bar ```

The harder problem however, is order in composite types.

Re:Migrating Facebook to MySQL 8.0 by marcosdumay on Saturday July 24, 2021 @03:14PM (#27943654)
Yeah, I do really recommend people not to do that sort of thing when they ask me.
Re:Migrating Facebook to MySQL 8.0 by throwaway2037 on Friday July 23, 2021 @03:17AM (#27928088)
Why was this down-voted? It is a good question. I thought exactly the same myself. And the reply from @setr is helpful. (Hat tip) I never thought about the impact of dump/restore!