Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
函数gen_random_uuid()的PostgreSQL查询在Windows上不起作用_Postgresql_Pgcrypto - Fatal编程技术网

函数gen_random_uuid()的PostgreSQL查询在Windows上不起作用

函数gen_random_uuid()的PostgreSQL查询在Windows上不起作用,postgresql,pgcrypto,Postgresql,Pgcrypto,我有以下创建表的查询 CREATE TABLE IF NOT EXISTS company ( id uuid CONSTRAINT companyid PRIMARY KEY DEFAULT gen_random_uuid(), name varchar(128) NOT NULL, db_uri varchar(255) NOT NULL, c_uri varchar(255) NOT NULL, date_c timestamp DEFAULT no

我有以下创建表的查询

CREATE TABLE IF NOT EXISTS company (
    id uuid CONSTRAINT companyid PRIMARY KEY DEFAULT gen_random_uuid(),
    name varchar(128) NOT NULL,
    db_uri varchar(255) NOT NULL,
    c_uri varchar(255) NOT NULL,
    date_c timestamp DEFAULT now(),
    date_m timestamp DEFAULT now()
    ) WITH (fillfactor=90);
当我通过pgAdminIII运行它时,我得到了以下错误

ERROR:  function gen_random_uuid() does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
********** Error **********
ERROR: function gen_random_uuid() does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
我已经创建了一个扩展名
pgcrypto
,它包含gen_random_uuid()函数定义,但也没有帮助

我在MAC上运行了相同的脚本,一切都很好


我正在使用PostgreSQL 9.3。

问题在于PostgreSQL版本

在PostgreSQL 9.4以上版本中,
pgcrypto
具有
gen\u random\u uuid()
函数

安装了新版本,一切都很好


如果在非
public
的架构中安装了
pgcrypto
,请将架构名称添加到
search\u path
。是否尝试重新启动Postgres?如何安装扩展?你能给我们看看你的确切陈述吗?
\dx
向您展示了什么?您是否忘记了提交
createextension
语句?或者您是否将其安装到其他数据库中(扩展是针对每个数据库安装的,而不是全局安装的)我使用“CREATE extension”pgcrypto创建了扩展指挥部。它显示在pgAdmin数据库的扩展中。@tim-I重新设置,没有任何更改。