sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

`DROP TRIGGER` and `DROP EVENT TRIGGER` Postgres queries are quietly ignored

Open dubek opened this issue 6 months ago • 0 comments

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 avatar Apr 18 '25 03:04 dubek