我在PostgreSQL文档中找不到任何显示如何声明记录或行,同时声明元组结构的内容.如果您没有定义元组结构,则会收到错误"尚未分配的记录的元组结构是不确定的".
这就是我现在正在做的,它工作正常,但必须有一个更好的方法来做到这一点.
CREATE OR REPLACE FUNCTION my_func()
RETURNS TABLE (
"a" integer,
"b" varchar
) AS $$
DECLARE r record;
BEGIN
CREATE TEMP TABLE tmp_t (
"a" integer,
"b" varchar
);
-- Define the tuple structure of r by SELECTing an empty row into it.
-- Is there a more straight-forward way of doing this?
SELECT * INTO r
FROM tmp_t;
-- Now I can assign values to the record.
r.a := at.something FROM "another_table" at
WHERE at.some_id = 1; …Run Code Online (Sandbox Code Playgroud) 我在这里查询了一些问题以及在线观看和观看视频,但我仍然感到困惑的是IN,OUT.我问的原因是因为我正在编写一个程序,根据其他程序中的IN参数记录错误,
干杯!