调用其参数中包含数组的 PostgreSQL 函数的语法

发布于 2024-12-09 18:38:47 字数 698 浏览 1 评论 0原文

我正在测试一些我没有编写的 PostgreSQL 函数,其中一个函数的定义如下:

email_maker_for_new_work_order(integer, character varying, integer[]);

我试图这样调用它:

select email_maker_for_new_work_order(13987,"TEST_CeeLoGreen",['231822','267657','268399','270125','270127','270470','271320'])

但我收到错误:

ERROR:  syntax error at or near "["
LINE 1: ..._maker_for_new_work_order(13987,"TEST_CeeLoGreen",['231822',...
                                                             ^


********** Error **********

ERROR: syntax error at or near "["
SQL state: 42601
Character: 63

我尝试过在整数数组周围不使用单引号。但是,我在同一位置得到了基本相同的错误。

任何帮助将不胜感激。谢谢。

I am testing some PostgreSQL functions that I did not write, one of which is defined like:

email_maker_for_new_work_order(integer, character varying, integer[]);

I'm trying to call it like:

select email_maker_for_new_work_order(13987,"TEST_CeeLoGreen",['231822','267657','268399','270125','270127','270470','271320'])

But I get the error:

ERROR:  syntax error at or near "["
LINE 1: ..._maker_for_new_work_order(13987,"TEST_CeeLoGreen",['231822',...
                                                             ^


********** Error **********

ERROR: syntax error at or near "["
SQL state: 42601
Character: 63

I've tried without the single-quotes around the integer array. However, I get essentially the same error at the same location.

Any help would be appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开浅夏 2024-12-16 18:38:47

语法是

array[1,2,3]

,请注意,参数不是 '42' 中的字符串,而是像 42 这样的普通整数。

顺便说一下:"TEST_CeeLoGreen" 部分被解释为列名,而不是纯字符串。这是故意的吗?

The syntax is

array[1,2,3]

and note, that the arguments are not strings as in '42' but plain integers like 42.

By the way: The part "TEST_CeeLoGreen" is interpreted as a column name, not as a plain string. Is that intended?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文