一、实验背景
用navicat导出PostgreSQL的一个库(导出结构和数据),在另一个新库上执行,数据没有少,但是库的函数不见了!

二、解决办法
# pg_dump --help

# pg_restore --help

1. 导出库的结构和数据为sql文件
2. 导出库的函数为sql文件
3. 在新库上执行数据sql和函数sql


三、参考
Postgresql dump all functions to a file
https://newfivefour.com/postgresql-dump-functions.html
postgresql只导出函数
https://www.centos.bz/2017/11/postgresql%E5%8F%AA%E5%AF%BC%E5%87%BA%E5%87%BD%E6%95%B0
How to take backup of functions only in Postgres
https://www.endpoint.com/blog/2010/01/31/postgresql-tip-using-pgdump-to-extract
https://stackoverflow.com/questions/13758003/how-to-take-backup-of-functions-only-in-postgres
本文介绍了一种解决使用Navicat迁移PostgreSQL数据库时函数丢失的问题。通过分步导出数据与函数的方法,确保了数据及函数完整迁移。文章提供了具体的导出与恢复命令,并附带相关参考资料。

被折叠的 条评论
为什么被折叠?



