You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Very interesting. For PostgreSQL, sqlc initializes the catalog with a default schema so that you don't need to include CREATE SCHEMA public in your DDL statements. The work around is to comment out the CREATE SCHEMA public line (or change it to CREATE SCHEMA IF NOT EXISTS public), but sqlc should be smart enough to handle this case, especially since pg_dump is such a common tool.
In the long term, I think we should treat CEATE SCHEMA public as CREATE SCHEMA IF NOT EXISTS public, but only for the public schema.
Hello, I've submitted a pull request #2495 to address this issue. In the pull request, I've updated the code to treat CREATE SCHEMA public as CREATE SCHEMA IF NOT EXISTS public for the public schema. Please review and let me know if there are any concerns or feedback. Thanks!
Uh oh!
There was an error while loading. Please reload this page.
Version
Other
What happened?
After I run migrations I run pg_dump to create the schema file (I tried adding a bunch of flags to reduce what gets put in there):
Which has the following line that breaks
generate
Relevant log output
database/structure.sql:1:1: schema "public" already exists
Database schema
SQL queries
Configuration
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: