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

CREATE TRIGGER statements fail to parse #103

Open
valeneiko opened this issue Jun 29, 2022 · 1 comment
Open

CREATE TRIGGER statements fail to parse #103

valeneiko opened this issue Jun 29, 2022 · 1 comment

Comments

@valeneiko
Copy link

Parsing:

CREATE TRIGGER t1 BEFORE UPDATE ON foo
FOR EACH ROW
WHEN (OLD.bar = False)
EXECUTE PROCEDURE p1();

Fails with:

Error: Syntax error at line 1 col 16:

  CREATE TRIGGER t1
                 ^
Unexpected word token: "t1". I did not expect any more input. Here is the state of my parse table:

    kw_view  %word  
    kw_recursive  %word  
    kw_global  %word  
    kw_local  %word  
    kw_unlogged  %word  
    kw_index  %word  
    kw_sequence  %word  
    kw_temporary  %word  
    kw_temp  %word  
    kw_function  %word  
    kw_extension  %word  
    kw_type  %word  
    kw_materialized  %word  
    kw_schema  %word  

    at Parser.feed (/src/node_modules/nearley/lib/nearley.js:343:27)
    at _parse (/src/node_modules/pgsql-ast-parser/src/parser.ts:110:16)
    at doParse (/src/node_modules/pgsql-ast-parser/src/parser.ts:57:27)
    at Object.parse (/src/node_modules/pgsql-ast-parser/src/parser.ts:60:11)
@fabiobsantos92
Copy link

fabiobsantos92 commented May 17, 2023

Today we face the same problem trying to create a trigger:
Parsing:
create trigger t1 after insert or update on schema.table_name for each row execute function schema.db_function();
Fails with:
Unexpected word token: "t1". I did not expect any more input. Here is the state of my parse table:

kw_view → %word ● 
kw_recursive → %word ● 
kw_global → %word ● 
kw_local → %word ● 
kw_unlogged → %word ● 
kw_index → %word ● 
kw_sequence → %word ● 
kw_temporary → %word ● 
kw_temp → %word ● 
kw_function → %word ● 
kw_extension → %word ● 
kw_type → %word ● 
kw_materialized → %word ● 
kw_schema → %word ● 

At version 11.0.0 we have already the support for drop trigger: #105
So please make some effort to not leave this behind.

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

No branches or pull requests

2 participants