导航

Installing "uuid-ossp" library in Postgres 9.1

Posted on 2013-05-08 15:21  eastson  阅读(802)  评论(0编辑  收藏  举报
The "uuid-ossp" library enables you to generate UUID values server-side in Postgres.
http://www.postgresql.org/docs/current/static/uuid-ossp.html

The technique to install this library changed as of Postgres 9.1, because of the new Extension feature. Installing and uninstalling are now easier. I have an overview on my blog, but I'm posting the brief steps here for posterity.

To see what extensions are already installed in your Postgres, run this SQL:
  select * from pg_extension;

To see if the "uuid-ossp" extension is available, run this SQL:
  select * from pg_available_extensions;

To install/load the extension, run this SQL:
  CREATE EXTENSION "uuid-ossp";

I found the quote marks to be required despite the doc being contrary.

Doc on loading extensions:
http://www.postgresql.org/docs/current/static/sql-createextension.html

如果出现 错误: 无法加载库 "C:/PostgreSQL/9.1/lib/uuid-ossp.dll": This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. SQL 状态: 58P01 这样的错误,安装VC++2005运行时库即可解决问题!