如何解决 adminpack 的 PostgreSQL pgAdmin 错误“未安装服务器检测”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16112752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 00:09:14  来源:igfitidea点击:

How to solve PostgreSQL pgAdmin error "Server instrumentation not installed" for adminpack?

postgresqlubuntupgadminpsql

提问by joelparkerhenderson

PostgreSQL 9.1 pgAdmin III on Ubuntu is giving this warning:

Ubuntu 上的 PostgreSQL 9.1 pgAdmin III 发出此警告:

Guru Hint - Server instrumentation not installed

Server Instrumentation

The server lacks instrumentation functions.

pgAdmin II uses some support functions that are not available by default in all PostgreSQL versions...

The adminpack is installed and actived by default if ...

Once your extension is installed, you only need to click on the "Fix it!" button ...

Guru 提示 - 服务器检测未安装

服务器检测

服务器缺少检测功能。

pgAdmin II 使用了一些在所有 PostgreSQL 版本中默认不可用的支持功能...

adminpack 默认安装并激活,如果...

安装扩展后,您只需要单击“修复它!” 按钮 ...

How to solve this?

如何解决这个问题?

回答by joelparkerhenderson

For current versions of PostgreSQL and pgAdmin, the "Guru" dialog warning has a "Fix it!" button or command. Use it.

对于当前版本的 PostgreSQL 和 pgAdmin,“Guru”对话框警告有一个“修复它!” 按钮或命令。用它。

If there's no "Fix it!" then we can use the Unix command line as follows.

如果没有“修复它!” 那么我们可以使用Unix命令行如下。

This is for PostgreSQL 9.1. Older versions do it differently.

这适用于 PostgreSQL 9.1。旧版本的做法不同。

PostgresSQL docs are here:

PostgresSQL 文档在这里:

Install adminpacklike this:

adminpack像这样安装:

$ sudo apt-get install postgresql-contrib

To verify we got the files, list them:

要验证我们获得了文件,请列出它们:

$ dpkg -L postgresql-contrib-9.1 | grep adminpack

Result:

结果:

/usr/share/postgresql/9.1/extension/adminpack.control
/usr/share/postgresql/9.1/extension/adminpack--1.0.sql
/usr/lib/postgresql/9.1/lib/adminpack.so

Alternate way to find the adminpack files:

查找 adminpack 文件的替代方法:

$ sudo updatedb
$ locate adminpack

Use psql to create the extension:

使用 psql 创建扩展:

$ sudo -u postgres -i
$ psql [dbname]
# CREATE EXTENSION adminpack;

(If you don't have super-user or if you need to create a per-db extension, see the comments below by @w00t to use \c dbnameto connect to the database)

(如果你没有超级用户或者如果你需要创建一个 per-db 扩展,请参阅@w00t 下面的评论以用于\c dbname连接到数据库)

To verify:

验证:

# select * from pg_extension;

Result:

结果:

extname  | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition 
-----------+----------+--------------+----------------+------------+-----------+--------------
plpgsql   |       10 |           11 | f              | 1.0        |           | 
adminpack |       10 |           11 | f              | 1.0        |           | 

To load the extension into pgAdmin, see the database server icon:

要将扩展加载到 pgAdmin,请参阅数据库服务器图标:

  • Right-click the icon then choose "Disconnent"
  • Right-click the icon then choose "Connent"
  • 右键单击该图标,然后选择“Disconnent”
  • 右键单击该图标,然后选择“Connent”

To verify adminpack is working:

要验证 adminpack 是否正常工作:

  • Click a database icon
  • On the top-right pane, click the "Statistics" tab.
  • Scroll to the bottom of the Statistics.
  • You now see a "Size" entry that shows the database size on disk.
  • 单击数据库图标
  • 在右上角的窗格中,单击“统计”选项卡。
  • 滚动到统计底部。
  • 您现在会看到一个“大小”条目,显示磁盘上的数据库大小。

回答by bronzenose

The "Fix It!" button would appear in the "Guru Hint" dialog next to OK and Cancel. If you are not offered the button, enter the following in a console:

“修复它!” 按钮将出现在确定和取消旁边的“大师提示”对话框中。如果没有为您提供该按钮,请在控制台中输入以下内容:

sudo apt-get install postgresql-contrib

then click the guru button (in my version, a face to the left of the ? button) and the "Fix It!" button should appear. Click it.

然后单击 guru 按钮(在我的版本中,是 ? 按钮左侧的一张脸)和“修复它!” 按钮应该出现。点击它。

See the answer from joelparkerhenderson if the Fix It! button doesn't appear.

如果修复它,请参阅 joelparkerhenderson 的答案!按钮不出现。