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
{{ message }}
Repository navigation
Review #2377 for code improvements: CALL triggers get the row instead of their arguments #2685
This is not a bug report. It is an invitation to look at #2377 again, because it passes the row to a CALL trigger by replacing the arguments the user wrote. The goal is to understand the change and decide whether anything should be improved. The notes below come from a quick read of the diff and a few runs, not from a full analysis.
The concerns:
The written arguments are dropped.alasql.executeTrigger (src/71trigger.js) calls alasql.fn[funcid](...row) whenever the trigger statement is a function call, so CREATE TRIGGER tr AFTER INSERT ON t CALL LOG('hello', 42) calls LOG({id: 1}). Before Fix SQL-99 trigger CALL syntax to pass row data parameters #2377 the statement ran as written and LOG received 'hello', 42. The arguments still parse, so nothing tells the user they are ignored.
The row reaches the function only by position. In SQL the trigger body reads the row through NEW / OLD (REFERENCING NEW ROW AS n in SQL-99). Making the row available to the trigger statement under those names, and running the statement with its own arguments, would let CALL LOG(NEW.id) and CALL LOG('hello') both work.
Activity