I have a PostgreSQL database with PostGIS functions loaded into it. I would like to dump out the schema of the database, but pg_dump -s dumps out the functions along with the table definitions.
Is there a way to exclude the functions and just dump the table definitions?
For all I know,
pg_dumpandpg_dumpalldo not support any such restriction.You could move all your functions to a dedicated schema which you could exclude from the dump like this:
If you go that route, you can migrate functions to another schema like this:
In this case I would also adapt the
search_pathinpostgresql.conf(and possibly in the defaults for databases and roles)As an alternative, you could leave the functions in their default schema
publicand not use that schema for anything else. Put your objects in one or more separate schemas. That should make upgrading PostGis easier.It may be a good idea to not use the
publicschema for your objects. I usually reserve it for PostGis or other extensions that install intopublicby default. I like to use a dedicated schema for every application. Makes maintenance easier – including backups and granting permissions.