首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在PostgreSQL上安装带有扩展orafce的架构

在PostgreSQL上安装带有扩展orafce的架构
EN

Stack Overflow用户
提问于 2017-07-05 07:37:48
回答 1查看 1.2K关注 0票数 2

我在PostgreSQL 9.5上安装了orafce扩展。我看到,最好为所有扩展创建一个特定的模式,我所做的也是如此。我连接到模板1并执行以下命令:

代码语言:javascript
复制
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函数时,例如,数据库无法识别该函数:

代码语言:javascript
复制
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..)而不是在我的新架构扩展下。

EN

回答 1

Stack Overflow用户

发布于 2017-07-05 07:52:33

PostgreSQL中的扩展是数据库级别,而不是架构级别或实例级别。不能在同一个数据库中创建相同的扩展。但是您可以在多个数据库中创建相同的扩展。这就是PostgreSQL中扩展的工作方式。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44919833

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档