[英]PostgreSQL Function that updates a specific column of a row
I am trying to make a function which calls a specific data from the table but why it's showing column doesn't exist even tho its on database . 我试图做一个从表中调用特定数据的函数,但是为什么它显示列甚至在数据库上也不存在。
CREATE FUNCTION public."updateDB"(IN userid bigint DEFAULT 00000, OUT uinfo json, IN clname text DEFAULT info)
RETURNS json
LANGUAGE 'plpgsql'
AS $BODY$
BEGIN
SELECT clname into uinfo
FROM public.users
WHERE uid = userid;
END;
$BODY$;
but when i try to call it , it shows this error here i tried to make info default so this error occurs . 但是当我尝试调用它时,它在这里显示此错误 ,因此我尝试将信息设置为默认值,因此发生此错误。 If i don't make anything default and run the function from code , it shows that error again.
如果我没有做任何默认设置并从code运行函数,它将再次显示该错误。
您需要引用文本,否则postgres认为您是在指一列
IN clname text DEFAULT 'info'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.