【问题标题】:How to use extensions in Postgres installed with Homebrew on Mac OSX如何在 Mac OSX 上使用 Homebrew 安装的 Postgres 中的扩展
【发布时间】:2018-03-22 04:46:23
【问题描述】:

我想在 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 模块吗?

【问题讨论】:

  • 在 Linux 中你需要安装一个额外的包,例如yum install postgresql-contrig - 也许你需要在 OSX 上做类似的事情

标签: postgresql homebrew


【解决方案1】:

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

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

所以你检查并尝试:

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

等等……

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-13
    • 2016-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多