PostgreSQL:执行存储函数(即使已转换参数也出现错误)

PostgreSQL: execute a stored function (getting an error even though the arguments have been casted)

我 运行 遇到了一个我找不到解决方案的问题。

我已经成功创建了一个函数。这是函数名称和参数:

CREATE OR REPLACE FUNCTION app_private.create_user(username citext, email text, email_is_verified boolean, name text, avatar_url text, title text DEFAULT NULL::text, color character varying DEFAULT NULL::character varying, user_role smallint DEFAULT 0, password text DEFAULT NULL::text)
RETURNS app_public.users
....
CREATE FUNCTION

我也成功授予角色执行功能的权限。并且还创建了评论:

grant execute on function app_private.create_user(username citext, email text, email_is_verified bool, name text, avatar_url text, title text, color varchar(7), user_role smallint, password text) to nine_manager;
GRANT    
comment on function app_private.create_user(username citext, email text, email_is_verified bool, name text, avatar_url text, title text, color varchar(7), user_role smallint, password text) is  
    E'Creates a user account.';
COMMENT

但是,当我尝试通过查询创建测试用户时:

SELECT "app_private.create_user"('JS0'::citext, 'test@gmail.com'::text, true::boolean, 'John Smith'::text, 'SY'::text, 'Manager'::text, '#000000'::varchar(7), 5::SMALLINT, 'test'::text);

我收到一个错误:

ERROR: function app_private.create_user(citext, text, boolean, text, text, text, character varying, smallint, text) does not exist
LINE 1: SELECT "app_private.create_user"('SY0'::citext, 'test@gmail....

我试过更改查询和转换但失败了。差点把我的头发拔出来。

提前谢谢你。

在 select 中调用您的函数之前删除双引号,如下所示

     Select app_private.create_user(....)
      From table;