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

Add Postgres Create trigger support #626

Open
zidaye opened this issue Sep 27, 2022 · 2 comments
Open

Add Postgres Create trigger support #626

zidaye opened this issue Sep 27, 2022 · 2 comments

Comments

@zidaye
Copy link
Contributor

zidaye commented Sep 27, 2022

We have a trigger that updates the field time

CREATE OR REPLACE FUNCTION updated_at() RETURNS trigger AS $$
BEGIN
    IF (
        NEW IS DISTINCT FROM OLD AND
        NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at
    ) THEN
        NEW.updated_at := current_timestamp;
    END IF;
    RETURN NEW;
END;
$$ LANGUAGE plpgsql;
@AugustoFKL
Copy link
Contributor

Isn't this the CREATE FUNCTION statement? (1)

[1] : https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#SQL-invoked-function

@zidaye
Copy link
Contributor Author

zidaye commented Oct 10, 2022

Isn't this the CREATE FUNCTION statement? (1)

[1] : https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#SQL-invoked-function

when parsing the above sql will return an error, I hope sqlparser will consider supporting parsing such sql.

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