我有一个plpgsql函数,它以记录作为参数。
I would like to call this function in the RETURNING
statement of an insert, but am unsure what to put as the argument (*
does not work) i.e.,
-- Postgres 12
INSERT INTO some_table (a, b, c)
VALUES .....
RETURNING
function_that_takes_record_argument(<the_new_record>)
What can I use in place of <the_new_record>
?
要将记录/行传递给函数,您需要明确指定记录类型:
我不确定为什么您的示例不起作用,但是我会尝试修改数据的CTE:
See more at https://www.postgresql.org/docs/current/queries-with.html#QUERIES-WITH-MODIFYING