Installing "uuid-ossp" library in Postgres 9.1

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运行时库即可解决问题!

你可能感兴趣的:(postgres)