PostgreSQL程序语言"C"未找到 [英] PostgreSQL procedural language "C" not found

查看:199
本文介绍了PostgreSQL程序语言"C"未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在PostgreSQL 9.2数据库中使用 PL/R 过程语言.我已经安装了plr语言,并且试图将其添加到数据库中.当我运行命令CREATE EXTENSION plr;时,出现以下错误:

I am trying to use the PL/R procedural language in a PostgreSQL 9.2 database. I have installed the plr language and I am trying to add it to a database. When I run the command CREATE EXTENSION plr; I get the following error:

ERROR:  language "C" does not exist
STATEMENT:  CREATE EXTENSION plr;
ERROR:  language "C" does not exist

当我用select * from pg_language;列出数据库中的可用语言时,会得到

When I list the available languages in the database with select * from pg_language; I get

 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,但不是大写字母(不确定是否会有所不同).

So there is a language c but it is not in capital letters (not sure if that makes a difference).

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

I am wondering why the plr extension does not find the C procedural language?

推荐答案

您可能正在PostgreSQL 9.2中遇到此更改(引用

You are probably running into this change in PostgreSQL 9.2 (quoting the release notes here):

不再在CREATE中强制使用小写的过程语言名称 功能(罗伯特·哈斯)

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

尽管未引用的语言标识符仍为小写,但字符串和 带引号的标识符不再强制转换为小写.因此,例如 创建功能...语言"C"将不再起作用;肯定是 拼写为"c",或者最好省略引号.

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.

它也反映在 CREATE FUNCTION手册

It's also reflected in the manual for CREATE FUNCTION

语言名称

函数所用语言的名称.可以是SQLCinternal或用户定义的过程的名称. 语言.为了向后兼容,名称可以用 单引号.

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 cLANGUAGE C.

Quoting the language name has been discouraged since at least version 7.3 (maybe longer), but old habits die hard, obviously. Removing the quotes around 'C' fixes the problem, arriving at: LANGUAGE c or LANGUAGE C.

PL/R尚未针对PostgreSQL 9.2做好准备. >.

PL/R wasn't ready for PostgreSQL 9.2 in that respect, judging from the project page.

Joe Conway留下的答案已被删除,因为它应该是评论.我将其粘贴到看不到已删除答案的普通公众中:

Joe Conway left an answer that got deleted because it should be a comment. I paste it here for the general public who can't see deleted answers:

我得到了消息,只是没有时间做一个新的PL/R版本. 寻找到十二月,但与此同时手动解决方法 上面提到的非常简单.

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.

这篇关于PostgreSQL程序语言"C"未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆