0

嗨,我有 PostgreSQL 12 由 homebrew 安装,我在这个提交https://github.com/pgpartman/pg_partman/commit/63328c5bd1f8009fc95592fcdd8ff45f148829e6克隆了 pg_partman 。

在克隆的文件夹中,我跑了,make install但它说:

(pg_partman) git:(master) $ make install

cat sql/types/types.sql sql/tables/tables.sql sql/functions/apply_cluster.sql sql/functions/apply_constraints.sql sql/functions/apply_foreign_keys.sql sql/functions/apply_privileges.sql sql/functions/apply_publications.sql sql/functions/autovacuum_off.sql sql/functions/autovacuum_reset.sql sql/functions/check_control_type.sql sql/functions/check_default.sql sql/functions/check_name_length.sql sql/functions/check_subpart_sameconfig.sql sql/functions/check_subpartition_limits.sql sql/functions/create_function_id.sql sql/functions/create_function_time.sql sql/functions/create_parent.sql sql/functions/create_partition_id.sql sql/functions/create_partition_time.sql sql/functions/create_sub_parent.sql sql/functions/create_trigger.sql sql/functions/drop_constraints.sql sql/functions/drop_partition_column.sql sql/functions/drop_partition_id.sql sql/functions/drop_partition_time.sql sql/functions/dump_partition_table_definition.sql sql/functions/inherit_template_properties.sql sql/functions/partition_data_id.sql sql/functions/partition_data_time.sql sql/functions/partition_gap_fill.sql sql/functions/reapply_privileges.sql sql/functions/run_maintenance.sql sql/functions/show_partition_info.sql sql/functions/show_partition_name.sql sql/functions/show_partitions.sql sql/functions/stop_sub_partition.sql sql/functions/undo_partition.sql sql/procedures/partition_data_proc.sql sql/procedures/reapply_constraints_proc.sql sql/procedures/run_maintenance_proc.sql sql/procedures/undo_partition_proc.sql > sql/pg_partman--4.4.1.sql
clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2  -I. -I./ -I/usr/local/opt/postgresql@12/include/server -I/usr/local/opt/postgresql@12/include/internal -I/usr/local/Cellar/icu4c/67.1/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include   -c -o src/pg_partman_bgw.o src/pg_partman_bgw.c
src/pg_partman_bgw.c:10:10: fatal error: 'postgres.h' file not found
#include "postgres.h"
         ^~~~~~~~~~~~
1 error generated.
make: *** [src/pg_partman_bgw.o] Error 1

快速调查建议安装 postgresql-server-dev-12,但我找不到任何与 macOS 相关的东西。

知道我错过了什么吗?提前致谢!

4

2 回答 2

1

当我问这个问题时,我认为我安装了一个错误的 PostgreSQL(这就是为什么缺少标题)。所以如果你遇到同样的错误,你可以尝试重新安装你的 PostgreSQL

pg_partman的安装与他们的 README 描述的完全一样。克隆存储库,更改 PostgreSQL 配置,重新启动 PostgreSQL,然后运行CREATE EXTENSION​​.

$ git clone https://github.com/pgpartman/pg_partman.git
$ cd pg_partman
$ make install

$ vim /usr/local/var/postgres/postgresql.conf
shared_preload_libraries = 'pg_partman_bgw'     # (change requires restart)

$ brew services restart postgresql

$ psql yourdb
=# CREATE EXTENSION pg_partman;

然后你可以\dx看看你是否安装正确:

List of installed extensions
        Name        | Version |   Schema   |                              Description
--------------------+---------+------------+------------------------------------------------------------------------
 pg_partman         | 4.5.1   | public     | Extension to manage partitioned tables by time or ID
于 2021-07-27T12:54:50.657 回答
0

或者使用来自https://github.com/sj26/homebrew-postgresql-extensions/的自定义自制公式:

$ brew install sj26/postgresql-extensions/pg_partman

然后按照说明编辑 postgresql conf。

于 2021-11-30T04:18:16.587 回答