You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Given these tables and this AFTER UPDATE trigger:
CREATE TABLE Movie (
id INTEGER PRIMARY KEY NOT NULL,
name TEXT NOT NULL,
companyId INTEGER NOT NULL REFERENCES Company("id"),
rating INTEGER NOT NULL
);
CREATE TABLE Company (
id INTEGER PRIMARY KEY NOT NULL,
name TEXT NOT NULL,
rating_total INTEGER NOT NULL
);
CREATE TRIGGER IF NOT EXISTS aggregate_ratings
AFTER UPDATE ON Movie
BEGIN
UPDATE Company
SET rating_total = rating_total + (new.rating - old.rating)
WHERE Company.id = new.companyId;
END;
and these statements:
upsert:
INSERT INTO Movie (id, name, companyId, rating) VALUES (?, ?, ?, ?)
ON CONFLICT (id)
DO UPDATE SET rating = excluded.rating;
getAllRatings:
SELECT id, rating_total FROM Company;
getAllRatings() is impacted by an AFTER UPDATE trigger, which can be fired by upsert(). But the synthesized implementation of upsert() does not include any listener callout code.
It seems like the compiler only looks through INSERT triggers for queries being impacted by an UPSERT statements, but not walking through the UPDATE triggers too.
The text was updated successfully, but these errors were encountered:
andersio
changed the title
Queries impacted by AFTER UPDATE triggers are not included in listener callouts by UPSERT statements.
Queries impacted by UPDATE triggers are not included in listener callouts by UPSERT statements.
Mar 17, 2021
Build Environment
SQLDelight version: 1.4.4
OS: iOS
Kotlin version: 1.4.31
Describe the bug
Given these tables and this AFTER UPDATE trigger:
and these statements:
getAllRatings()
is impacted by an AFTER UPDATE trigger, which can be fired byupsert()
. But the synthesized implementation ofupsert()
does not include any listener callout code.It seems like the compiler only looks through INSERT triggers for queries being impacted by an UPSERT statements, but not walking through the UPDATE triggers too.
The text was updated successfully, but these errors were encountered: