pg_dump 排除的功能
pg_dump excluded functions
我使用以下命令创建了一个 pg_dump -
pg_dump -U postgres -d db -n public \
--exclude-table-data 'exclude_table_*' \
--exclude-table-data 'another_set_of_tables_to_exclude*' > dump.sql
这排除了我需要它排除的表,但它没有转储 public
模式中的任何函数。为什么它不转储函数,我如何让它转储它们?
更新
这是物化视图的定义 -
CREATE MATERIALIZED VIEW public.attending AS
SELECT (split_part((ct.id)::text, '-'::text, 1))::bigint AS
attending_physician,
split_part((ct.id)::text, '-'::text, 2) AS business,
(split_part((ct.id)::text, '-'::text, 3))::bigint AS organization,
split_part((ct.id)::text, '-'::text, 4) AS county,
ct.id,
ct."qtr-0",
ct."qtr-1",
ct."qtr-2",
ct."qtr-3",
ct."qtr-4",
ct."qtr-5",
ct."qtr-6",
ct."qtr-7",
ct."qtr-8"
FROM crosstab('SELECT attending_practitioner || ''-'' || business || ''-'' || organization || ''-'' || county AS id, period, COALESCE(admits, 0)
FROM calc ORDER BY 1, 2 DESC'::text, 'SELECT year || ''q'' || quarter FROM calc_trend ORDER BY 1 DESC limit 9'::text) ct(id character varying(32), "qtr-0" integer, "qtr-1" integer, "qtr-2" integer, "qtr-3" integer, "qtr-4" integer, "qtr-5" integer, "qtr-6" integer, "qtr-7" integer, "qtr-8" integer);
它应该在 public
模式中转储函数(和所有其他对象)。
未 转储的函数是扩展的一部分,例如您的 crosstab
。此类对象不会单独转储,它们包含在 CREATE EXTENSION
.
中
不幸的是,扩展没有与模式转储一起转储(它们属于数据库)。
您应该在恢复转储之前在目标数据库上手动创建扩展:
CREATE EXTENSION crosstab;
我使用以下命令创建了一个 pg_dump -
pg_dump -U postgres -d db -n public \
--exclude-table-data 'exclude_table_*' \
--exclude-table-data 'another_set_of_tables_to_exclude*' > dump.sql
这排除了我需要它排除的表,但它没有转储 public
模式中的任何函数。为什么它不转储函数,我如何让它转储它们?
更新
这是物化视图的定义 -
CREATE MATERIALIZED VIEW public.attending AS
SELECT (split_part((ct.id)::text, '-'::text, 1))::bigint AS
attending_physician,
split_part((ct.id)::text, '-'::text, 2) AS business,
(split_part((ct.id)::text, '-'::text, 3))::bigint AS organization,
split_part((ct.id)::text, '-'::text, 4) AS county,
ct.id,
ct."qtr-0",
ct."qtr-1",
ct."qtr-2",
ct."qtr-3",
ct."qtr-4",
ct."qtr-5",
ct."qtr-6",
ct."qtr-7",
ct."qtr-8"
FROM crosstab('SELECT attending_practitioner || ''-'' || business || ''-'' || organization || ''-'' || county AS id, period, COALESCE(admits, 0)
FROM calc ORDER BY 1, 2 DESC'::text, 'SELECT year || ''q'' || quarter FROM calc_trend ORDER BY 1 DESC limit 9'::text) ct(id character varying(32), "qtr-0" integer, "qtr-1" integer, "qtr-2" integer, "qtr-3" integer, "qtr-4" integer, "qtr-5" integer, "qtr-6" integer, "qtr-7" integer, "qtr-8" integer);
它应该在 public
模式中转储函数(和所有其他对象)。
未 转储的函数是扩展的一部分,例如您的 crosstab
。此类对象不会单独转储,它们包含在 CREATE EXTENSION
.
不幸的是,扩展没有与模式转储一起转储(它们属于数据库)。
您应该在恢复转储之前在目标数据库上手动创建扩展:
CREATE EXTENSION crosstab;