Skip to content

DROP TRIGGER and DROP EVENT TRIGGER Postgres queries are quietly ignored #3935

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
dubek opened this issue Apr 18, 2025 · 0 comments
Open

Comments

@dubek
Copy link

dubek commented Apr 18, 2025

Version

1.29.0

What happened?

DROP TRIGGER and DROP EVENT TRIGGER exec Postgres queries are quietly ignored and no Go code is produced. If they are the only queries in the file, I get a error parsing queries: no queries contained in paths ...../query.sql error. Otherwise they are just skipped without error/warning.

Note that CREATE TRIGGER and CREATE EVENT TRIGGER queries actually work okay.

Relevant log output

Database schema

CREATE TABLE accounts (
  id INT PRIMARY KEY
);

SQL queries

-- name: DropTrigger :exec
DROP TRIGGER IF EXISTS my_trigger ON accounts;

-- name: DropEventTrigger :exec
DROP EVENT TRIGGER IF EXISTS my_event_trigger;

Configuration

version: "2"
sql:
  - engine: "postgresql"
    queries: "query.sql"
    schema: "schema.sql"
    gen:
      go:
        sql_package: "pgx/v5"
        package: "dbqueries"
        out: "dbqueries"
        emit_json_tags: true

Playground URL

https://play.sqlc.dev/p/7d3de2415e90a9f63813a4e2bf5c5a062f801272f032781039c2b8ee8d9706c0

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

@dubek dubek added the bug Something isn't working label Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant