sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.54k stars 809 forks source link

fix(dbmanager): use correct SQL to drop databases #3640

Closed scottt closed 1 month ago

scottt commented 1 month ago

Before this patch, ManagedClient.CreateDatabase could issue the following SQL:

DROP DATABASE mydb IF EXISTS WITH (FORCE)

which is not standard SQL and does not work with PostgreSQL. See https://www.postgresql.org/docs/current/sql-dropdatabase.html

This patch fixes to code to issue:

DROP DATABASE IF EXISTS mydb WITH (FORCE)

@kyleconroy , this patch fixes the DROP DATABASE syntax error introduced in https://github.com/sqlc-dev/sqlc/pull/3525 and https://github.com/sqlc-dev/sqlc/pull/3421

kyleconroy commented 1 month ago

Thank you!