我正在尝试将 PostgreSQL 与“七周内的七个数据库”一书一起使用。我在 Ubuntu 10.04 服务器上使用 PostgreSQL 8.4.1。
第一个任务是创建一个名为“book”的数据库并检查 contrib 包是否已正确安装。
$ createdb book
$ psql book -c "SELECT '1'::cube;"
当我这样做时,我得到以下输出:
ERROR: type "cube" does not exist
LINE 1: SELECT '1'::cube;
我已经使用以下命令安装了多维数据集包:
$ sudo -u postgres psql postgres < /usr/share/postgresql/8.4/contrib/cube.sql
我尝试重新启动 PostgreSQL,但问题仍然存在。当我第二次尝试运行包导入时,我收到以下消息,其中明确指出type "cube" already exists
:
SET
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
ERROR: type "cube" already exists
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
COMMENT
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
ERROR: operator < already exists
ERROR: operator > already exists
ERROR: operator <= already exists
ERROR: operator >= already exists
ERROR: operator && already exists
ERROR: operator = already exists
ERROR: operator <> already exists
ERROR: operator @> already exists
ERROR: operator <@ already exists
ERROR: operator @ already exists
ERROR: operator ~ already exists
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
ERROR: operator class "cube_ops" for access method "btree" already exists
ERROR: operator class "gist_cube_ops" for access method "gist" already exists
那么,我做错了什么?