Skip to content

False positive creating INSTEAD OF trigger #382

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

Open
2 tasks done
mplanchard opened this issue May 2, 2025 · 0 comments · May be fixed by #383
Open
2 tasks done

False positive creating INSTEAD OF trigger #382

mplanchard opened this issue May 2, 2025 · 0 comments · May be fixed by #383
Labels
bug Something isn't working

Comments

@mplanchard
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Creating a trigger yields several invalid syntax errors.

To Reproduce

Creating a trigger like:

CREATE OR REPLACE TRIGGER my_trigger
       INSTEAD OF INSERT ON my_table
       FOR EACH ROW
       EXECUTE FUNCTION my_table_trigger_fn();

yields the following errors:

data/001_my_migration.sql:58:26 syntax ━━━━━━━━━━━━━━━━━━━

  ✖ Expected Into
  
    57 │ CREATE OR REPLACE TRIGGER my_trigger
  > 58 │        INSTEAD OF INSERT ON my_table
       │                          ^^
    59 │        FOR EACH ROW
    60 │        EXECUTE FUNCTION my_table_trigger_fn();
  

data/001_my_migration.sql:57:1 syntax ━━━━━━━━━━━━━━━━━━━━

  ✖ Invalid statement: syntax error at end of input
  
  > 57 │ CREATE OR REPLACE TRIGGER my_trigger
       │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 58 │        INSTEAD OF INSERT ON my_table
       │        ^^^^^^^^^^
    59 │        FOR EACH ROW
    60 │        EXECUTE FUNCTION my_table_trigger_fn();
  

data/001_my_migration.sql.sql:58:19 syntax ━━━━━━━━━━━━━━━━━━━

  ✖ Invalid statement: syntax error at or near "ON"
  
    57 │ CREATE OR REPLACE TRIGGER my_trigger
  > 58 │        INSTEAD OF INSERT ON my_table
       │                   ^^^^^^^^^^^^^^^^^^
  > 59 │        FOR EACH ROW
  > 60 │        EXECUTE FUNCTION my_table_trigger_fn();
       │        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    61 │ 
  

Checked 1 file in 24ms. No fixes applied.
Found 3 errors.
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Expected behavior

The trigger creation is valid, so it should not generate errors.

System information

  • system: "x86_64-linux"
  • host os: Linux 6.6.85, NixOS, 24.11 (Vicuna), 24.11.20250405.7819a0d
@mplanchard mplanchard added the bug Something isn't working label May 2, 2025
@psteinroe psteinroe linked a pull request May 2, 2025 that will close this issue
@mplanchard mplanchard changed the title False positive creating trigger False positive creating INSTEAD OF trigger May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant