我在PostgreSQL 9.5上安装了orafce扩展。我看到,最好为所有扩展创建一个特定的模式,我所做的也是如此。我连接到模板1并执行以下命令:
template1=# create schema extensions;
CREATE SCHEMA
template1=# grant usage on schema extensions to public;
GRANT
template1=# grant execute on all functions in schema extensions to public;
GRANT
template1=# alter default privileges in schema extensions grant execute on
functions to public;
ALTER DEFAULT PRIVILEGES
template1=# alter default privileges in schema extensions grant usage on
types to public;
ALTER DEFAULT PRIVILEGES
template1=# create extension orafce schema extensions;
CREATE EXTENSION
template1=# show search_path;
search_path
-----------------
"$user", public
(1 row)
template1=# set search_path="$user",public,extensions;
SET之后,我创建了一个新的数据库test1和一个新的用户mariel1。此外,我还编辑了postgresql.conf,并将search_path设置为"$user“、公共扩展。
我连接到数据库- psql -d test1 -U mariel1。现在,当我尝试使用sysdate函数时,例如,数据库无法识别该函数:
postgres=# select sysdate() from dual;
ERROR: function sysdate() does not exist
LINE 1: select sysdate() from dual;
^
HINT: No function matches the given name and argument types. You might need
to add explicit type casts.
postgres=# select extensions.sysdate() from dual;
ERROR: schema "extensions" does not exist
LINE 1: select extensions.sysdate() from dual;经过一些搜索,我发现一些函数可以在其他模式下使用,比如oracle、utl_file等。我想知道为什么orafce (oracle.sysdate等)的功能.在不同模式下创建(oracle、utl_file..)而不是在我的新架构扩展下。
发布于 2017-07-05 07:52:33
PostgreSQL中的扩展是数据库级别,而不是架构级别或实例级别。不能在同一个数据库中创建相同的扩展。但是您可以在多个数据库中创建相同的扩展。这就是PostgreSQL中扩展的工作方式。
https://stackoverflow.com/questions/44919833
复制相似问题