我有这个postgresql函数:
drop function public.get_comments;
CREATE OR REPLACE FUNCTION public.get_comments(in_post_id character varying)
RETURNS table (
cid varchar,
ccontent text,
cmnt_count bigint
)
LANGUAGE plpgsql
AS $function$
declare
-- arr_comments record [];
rec record;
postRecord record;
tagLabel varchar;
begin
return query
select id, "content", (
select count(*) from comments_reply where comment_id=c.id
) as reply_count
from post_comments c
where c.post_id = '863550630468626253';
END
$function$
;
当我直接使用select public.get_comments('863550630468626253');
调用它时,它总共返回七行。但是当我从春季应用out
调用它时,只有一行,
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(dataSource).withProcedureName("get_comments")
.withCatalogName("public");
Map<String, Object> out = jdbcCall.execute(postId);
out.entrySet();