supabase-community/postgres-language-server

False positive creating INSTEAD OF trigger

Closed this issue · 0 comments

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