如何在Ubuntu 10.04上使用PostgreSQL 8.4.4生成uuid? [英] How to generate uuid with PostgreSQL 8.4.4 on Ubuntu 10.04?

查看:187
本文介绍了如何在Ubuntu 10.04上使用PostgreSQL 8.4.4生成uuid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Ubuntu 10.04上运行PostgreSQL 8.4.4。

I am running PostgreSQL 8.4.4 with Ubuntu 10.04.

我正在尝试生成uuid,但找不到解决方法。

I am trying to generate uuid but can't find a way to do it.

我确实在 /usr/share/postgresql/8.4/contrib/uuid-ossp.sql 中有uuid-ossp.sql

I do have the uuid-ossp.sql in /usr/share/postgresql/8.4/contrib/uuid-ossp.sql

当我尝试这就是我得到的:

When I try this is what I get :

postgres=# SELECT uuid_generate_v1();
ERROR:  function uuid_generate_v1() does not exist
LINE 1: SELECT uuid_generate_v1();
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

任何想法吗?

推荐答案

contrib 中的内容不会自动运行。您必须自己运行它才能安装功能。我不知道8.4版本,但在8.3版本中,它似乎仅按数据库安装它,因此打开您在psql中使用的数据库并发出命令 \i / usr / share / postgresql / 8.4 / contrib / uuid-ossp.sql

The stuff in contrib aren't run automatically. You have to run it yourself to install the functions. I don't know about the 8.4 version, but in the 8.3 version it appears to only install it per-database, so open up the database you're using in psql and issue the command \i /usr/share/postgresql/8.4/contrib/uuid-ossp.sql

这篇关于如何在Ubuntu 10.04上使用PostgreSQL 8.4.4生成uuid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆