postgresql 无法使用 uuid 并创建扩展来使用它
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20810921/
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
Can't use uuid and create an extension to use it
提问by アレックス
I want to use uuid in Postgresql 9.2 on Ubuntu 13. So when I tried to check whether is available or not, I did:
我想在 Ubuntu 13 上的 Postgresql 9.2 中使用 uuid。所以当我尝试检查是否可用时,我做了:
select uuid_generate_v4() as one;
And it gave me ERROR: function uuid_generate_v4() does not exist
它给了我 ERROR: function uuid_generate_v4() does not exist
Then I did CREATE EXTENSION "uuid-ossp";
然后我做了 CREATE EXTENSION "uuid-ossp";
ERROR: could not open extension control file "/usr/share/postgresql/9.2/extension/uuid-ossp.control": No such file or directory
Well, what do I do next?
嗯,接下来我该怎么办?
By the way, SELECT * FROM pg_available_extensions;
returns plpsql (1.0)
only.
顺便说一句,只SELECT * FROM pg_available_extensions;
返回plpsql (1.0)
。
回答by Peter Eisentraut
The operating system package that contains the extension is not installed. To install it:
未安装包含扩展的操作系统包。要安装它:
apt-get install postgresql-contrib-9.2
回答by user456584
For anyone using the asdf version managerwith the asdf-postgres plugin, installing postgres versions as follows fixes this issue:
对于使用asdf 版本管理器和asdf-postgres 插件的任何人,安装 postgres 版本如下可解决此问题:
POSTGRES_EXTRA_CONFIGURE_OPTIONS=--with-uuid=e2fs asdf install postgres <VERSION>
回答by Mohamed Dernoun
If you still get the error, try to run manually the two SQL files inside /usr/share/postgresql/9.X/extension/uuid-ossp*.sql
into your database
如果仍然出现错误,请尝试手动将里面的两个 SQL 文件运行/usr/share/postgresql/9.X/extension/uuid-ossp*.sql
到您的数据库中