Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If multiple triggers update the same object, only one is applied #7334

Closed
raddevon opened this issue May 10, 2024 · 1 comment
Closed

If multiple triggers update the same object, only one is applied #7334

raddevon opened this issue May 10, 2024 · 1 comment
Labels

Comments

@raddevon
Copy link
Contributor

raddevon commented May 10, 2024

If you add more update triggers to this, only one update actually runs. I added a p3 property and trigger, and that was the one that ran. I then added another trigger to update p1 again, and only the p3 update ran.

  • EdgeDB Version: 5.3+a480d96
  • EdgeDB CLI Version: 5.1.0+8ff9f85
  • OS Version: macOS 14.0

Steps to Reproduce:

  1. Apply the schema
  2. Insert a User
  3. Update the user
  4. select Log {*} to see if both properties were set

Schema:

module default {
  type User {
    name: str;

    trigger add_log after insert for each do (
      insert Log {user := __new__}
    );
    trigger set_p1 after update for each do (
      update Log filter .user = __new__ set {
        p1 := 'string 1'
      }
    );
    trigger set_p2 after update for each do (
      update Log filter .user = __new__ set {
        p2 := 'string 2'
      }
    );
  }
  type Log {
    user: User;
    p1: str;
    p2: str;
  }
}
@raddevon raddevon added the bug label May 10, 2024
@raddevon
Copy link
Contributor Author

This is as-intended. I thought triggers ran separate queries in a single transaction, but they actually run in a single query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant