如何在Mac OSX上使用Homebrew安装的Postgres中使用扩展

时间:2018-03-22 04:46:24

标签: postgresql homebrew

我想在Postgres 10.2中使用SPI extension,我在Homebrew中安装了它。然而,

CREATE EXTENSION spi;

失败
ERROR:  could not open extension control file "/usr/local/share/postgresql/extension/spi.control": No such file or directory

查看extension目录,我看到很多扩展,但不是SPI。 Postgres documentation mentions扩展名将驻留在发行版的contrib目录中,然后您可以单独构建它们,但我似乎无法在任何地方找到此目录。知道如何获取和安装SPI模块吗?

1 个答案:

答案 0 :(得分:2)

https://www.postgresql.org/docs/current/static/contrib-spi.html

  

下面描述的每组功能都作为a提供   可单独安装的扩展。

所以你检查并尝试:

t=# select * from pg_available_extensions where name in ('refint','timetravel','autoinc','insert_username','moddatetime');
      name       | default_version | installed_version |                           comment
-----------------+-----------------+-------------------+-------------------------------------------------------------
 moddatetime     | 1.0             |                   | functions for tracking last modification time
 autoinc         | 1.0             |                   | functions for autoincrementing fields
 insert_username | 1.0             |                   | functions for tracking who changed a table
 timetravel      | 1.0             |                   | functions for implementing time travel
 refint          | 1.0             |                   | functions for implementing referential integrity (obsolete)
(5 rows)

t=# create extension refint ;
CREATE EXTENSION
t=# create extension timetravel;
CREATE EXTENSION

依旧......