Can't use uuid and create an extension to use it

匿名 (未验证) 提交于 2019-12-03 02:05:01

问题:

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:

select uuid_generate_v4() as one; 

And it gave me ERROR: function uuid_generate_v4() does not exist

Then I did 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.

回答1:

The operating system package that contains the extension is not installed. To install it:

apt-get install postgresql-contrib-9.2 


回答2:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!