Syntax error when exporting to a .sql file

Raven's profile image Raven posted 1 year ago in Import/Export Permalink

Hello, I would like to export my database without content to a .sql file. Currently I get an error with every table according to the following scheme: Error: syntax error at or near "CREATE "LINE 1: SHOW CREATE DATABASE "PUBLIC" Do you have any idea? Thanks so much!

1 attachment(s):
  • export_error
gulshan212's profile image gulshan212 posted 12 months ago Permalink

Hello this is Gulshan Negi Well, I did a search on this and it is looking that you're trying to export a PostgreSQL database using the SHOW CREATE DATABASE command, which is not a valid PostgreSQL command. This command is used in MySQL to show the SQL statements that would create a database or a table. To export a PostgreSQL database without its content to a.sql file, you can use the pg_dump command. Here's an example command that you can use:

pg_dump --schema-only --no-owner --file=/path/to/export/file.sql your_database_name

Thanks

Please login to leave a reply, or register at first.