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

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

Conversation

scottt
Copy link
Contributor

@scottt scottt commented Oct 8, 2024

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 #3525 and #3421

Previously the code used:

```
DROP DATABASE mydb IF EXISTS WITH (FORCE)
```

which is not standard SQL and does not work with PostgreSQL.

This patch fixes to code to issue:

```
DROP DATABASE IF EXISTS mydb WITH (FORCE)
```
@kyleconroy kyleconroy added the bug Something isn't working label Oct 9, 2024
@kyleconroy
Copy link
Collaborator

Thank you!

@kyleconroy kyleconroy merged commit 695d9a1 into sqlc-dev:main Oct 9, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants