PostgreSQL程序语言“C”未找到

前端之家收集整理的这篇文章主要介绍了PostgreSQL程序语言“C”未找到前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在Postgresql 9.2数据库中使用 PL/R过程语言.我已经安装了plr语言,我正在尝试将其添加数据库中.当我运行命令CREATE EXTENSION plr;我收到以下错误
ERROR:  language "C" does not exist
STATEMENT:  CREATE EXTENSION plr;
ERROR:  language "C" does not exist

当我使用select * from pg_language列出数据库中的可用语言时;我明白了

lanname  | lanowner | lanispl | lanpltrusted | lanplcallfoid | laninline | lanvalidator | lanacl 
 ----------+----------+---------+--------------+---------------+-----------+--------------+--------
  internal |       10 | f       | f            |             0 |         0 |         2246 | 
  c        |       10 | f       | f            |             0 |         0 |         2247 | 
  sql      |       10 | f       | t            |             0 |         0 |         2248 | 
  plpgsql  |       10 | t       | t            |         12514 |     12515 |        12516 | 
 (4 rows)

所以有一种语言c但它不是大写字母(不确定这是否有所不同).

我想知道为什么plr扩展名没有找到C程序语言?

您可能在Postgresql 9.2(引用 release notes here)中遇到此更改:

No longer forcibly lowercase procedural language names in CREATE
FUNCTION (Robert Haas)

While unquoted language identifiers are still lowercased,strings and
quoted identifiers are no longer forcibly down-cased. Thus for example
CREATE FUNCTION … LANGUAGE ‘C’ will no longer work; it must be
spelled ‘c’,or better omit the quotes.

它也反映在manual for CREATE FUNCTION

lang_name

The name of the language that the function is implemented in. Can be sql,C,internal,or the name of a user-defined procedural
language. For backward compatibility,the name can be enclosed by
single quotes.

至少从版本7.3(可能更长)开始,不鼓励引用语言名称,但显然老习惯很难.删除’C’周围的引号可以解决问题,到达:LANGUAGE c或LANGUAGE C.

project page开始,PL / R在这方面还没有为Postgresql 9.2做好准备.

从反馈Joe Conway

Joe Conway留下了一个被删除的答案,因为它应该是一个评论.我将它粘贴到一般公众身上,无法看到已删除的答案:

I got the message,just haven’t had the time to do a new PL/R release. Look for it by December,but in the meantime the manual workaround noted above is pretty simple.

猜你在找的Postgre SQL相关文章