Gra*_*ham 17 postgresql sequences pg-dump
我想从我的pg_dump命令中排除一个序列,该命令将输出放入普通文件中.
Command: /Library/PostgreSQL/8.4/bin/pg_dump --host localhost --port 5433 --username xxx --format plain --clean --inserts --verbose --file /Users/xxx/documents/output/SYSTEM_admin_20131126015325.sql --exclude-table public.table1 --exclude-table public.table2 mydatabase
Run Code Online (Sandbox Code Playgroud)
我知道我正在使用上面的表的开关,你可以像pg_dump文档中所述的那样结合pg_restore启用/禁用tar格式的数据库对象,但我不会使用pg_restore.
非常感谢
格雷厄姆
Dan*_*ité 27
有两种情况:
要排除的序列由您也要转储的表所拥有(典型情况:SERIAL
列).
请参阅:在postgres中转储没有序列表的表
简答:不,序列不能放在一边.
序列不归转储表所有.然后可以使用--exclude-table
开关将其排除,就好像它是一个表格一样.
从pg_dump文档:
-T table --exclude-table = table
Run Code Online (Sandbox Code Playgroud)Do not dump any tables matching the table pattern.
根据与-t相同的规则解释模式
关于-t
:
-t table
--table = tableRun Code Online (Sandbox Code Playgroud)Dump only tables (or views or sequences or foreign tables) matching table
归档时间: |
|
查看次数: |
22691 次 |
最近记录: |