【发布时间】:2021-11-22 10:21:15
【问题描述】:
所以,我有这个架构:
node_mapping(node_id: UUID, node_name: text, related_ids: jsonb)
我想为此查询编写一个 postgres 函数,以便在 Springboot 中的 JPA 方法中获得一个 List 作为输出。
select CAST(node_id AS VARCHAR) node_id from node_mapping where related_ids::jsonb? _seller_id = true;
我写了这个函数,但它不起作用,请帮助我。
CREATE OR REPLACE FUNCTION find_node_id(_relation_id text)
RETURNS TABLE(node_id text) AS
$func$
BEGIN
RETURN QUERY select CAST(node_id AS VARCHAR) node_id from node_mapping where related_ids::jsonb? _relation_id = true;
END;
$func$ LANGUAGE plpgsql;
请帮帮我,我做错了什么?
【问题讨论】:
-
不工作是什么意思? stackoverflow.com/help/how-to-ask
-
请记住披露您收到的下一个问题的逐字错误消息。并且始终是您的 Postgres 版本。
标签: postgresql spring-boot jpa stored-functions