Oracle 在PostgreSQL上安装了扩展名为orafce的架构

Oracle 在PostgreSQL上安装了扩展名为orafce的架构,oracle,postgresql,orafce,Oracle,Postgresql,Orafce,我在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

我在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并将搜索路径设置为“$user”、public和extensions

我连接到数据库-
psql-dtest1-U marel1
。现在,当我尝试使用函数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_文件等等。我想了解为什么orafce(oracle.sysdate等)的函数是在不同的模式(oracle、utl_文件..)下创建的,而不是在我的新模式扩展名下创建的。

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

我在tempalte 1中创建了扩展,这意味着它将在我将创建的每个数据库中创建。我的问题是为什么扩展没有安装在我指定的模式中,而是安装在更多的模式中?我能知道什么“\dx”吗template1数据库和其他数据库中的输出?template1=#\dx已安装扩展名列表|版本|模式|说明---------+---------+------------+-----------------------------------------------------------------------------------------------orafce | 3.6 |扩展|模拟Oracle RDB MS plpgsql | 1.0 | pg | U目录| PL/pgSQL过程语言中函数和包子集的函数和运算符好的,我看到了,您的扩展已安装在扩展架构中。你能给我看看“\dx”吗另一个数据库?comb=#\dx已安装扩展名列表|版本|模式|说明---------------------------------------------------++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------orafce | 3.6 |扩展|模拟Oracle RDB MS plpgsql | 1.0 | pg|U目录| PL/pgSQL过程语言中函数和包子集的函数和运算符(2行)