gpt4 book ai didi

postgresql - 返回多行的 PostgreSQL 函数的问题

转载 作者:行者123 更新时间:2023-11-29 13:37:37 25 4
gpt4 key购买 nike

你好,我想从一个函数返回多行,但我有这个持续的错误任何人都可以帮助我,谢谢!!

错误代码如下:

    ERROR:  invalid input syntax for integer: "<html><HEAD id='header' father='*html'>
<title id="ttl" father="*head">KarinApp(Karina Application Web Maker)</title>
<link id="favIcon" href="http://www.karinapp.com/favicon.ico" rel="SHORTCUT ICON" />
<link id="jQueryUI" type="text/css" href="http://www.karinapp.com/modules/general/css/karinapp-style/jquery-ui-1.8.4.custom.css" rel="stylesheet" />
<link id="general_css" father="*head" rel="stylesheet" type="text/css" href="http://www.karinapp.com/modules/appgen/css/main.css" />
<script id='SCRIPT1' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/jQuery.js" father="*head"><!--empty--></script>
<script id='SCRIPT2' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.core.js"><!--empty--></script>
<script id='SCRIPT3' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.widget.js"><!--empty--></script>
<script id='SCRIPT4' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.mouse.js"><!--empty--></script>
<script id='SCRIPT5' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.draggable.js"><!--empty--></script>
<script id='SCRIPT6' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.droppable.js"><!--empty--></script>
<script id='SCRIPT8' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.position.js"><!--empty--></script>
<script id='SCRIPT9' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.resizable.js">\n<!--empty--></script>
<script id='SCRIPT10' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.dialog.js"><!--empty--></script>
<script id='SCRIPT12' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.button.js"><!--empty--></script>
<script id='SCRIPT12' type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.autocomplete.js"><!--empty--></script>
<script id='SCRIPT13' father="*head" type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/general.js"><!--empty--></script>
<script id='SCRIPT14' type="text/javascript" father="*head" src="http://www.karinapp.com/modules/general/scripts/Catcher.js"><!--empty--></script>
<script id='SCRIPT15' father="*head" type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/loadPage.js"><!--empty--></script>
<SCRIPT id="accordionScr" father="*head" type="text/javascript" src="/modules/general/scripts/ui/jquery.ui.accordion.js"><!--empty--></SCRIPT>
<script id='SCRIPT16' language="javascript" type="text/javascript" src="http://www.karinapp.com/modules/general/scripts/editor/edit_area_full.js"><!--empty--></script>
<script id='SCRIPT17' father="*head" type="text/javascript" src="http://www.karinapp.com/modules/appgen/scripts/main.js"><!--empty--></script>
<script id='SCRIPT18' father="*head" type="text/javascript" src="http://www.karinapp.com/modules/appgen/scripts/config.js"><!--empty--></script>
<script id='SCRIPT19' father="*head" type="text/javascript" src="http://www.karinapp.com/modules/appgen/scripts/style.js"><!--empty--></script>
<script id='HandleScr' father="*head" type="text/javascript" src="/modules/appgen/scripts/handle.js"><!--empty--></script>
<script id='SCRIPT20' father="*head" type="text/javascript" src="http://www.karinapp.com/modules/appgen/scripts/scripts.js"><!--empty--></script>
<script id='SCRIPT21' father="*head" type="text/javascript" src="http://www.karinapp.com/modules/appgen/scripts/properties.js"><!--empty--></script>

<script id='SCRIPT22' type="text/javascript">
window.onload = function(){
postLoad();
}
function __init__(){
main();
}
</script>
<SCRIPT father='*head' id="batuteJS" type="text/javascript" src="/modules/appgen/scripts/batute.js"><!--empty--></SCRIPT>
</HEAD>
<BODY id="general_bod">
<DIV id="body" father="*html"><!--empty--></DIV>
<DIV id="confPg" father="*body">
<LABEL id="radio0_lab" father="confPg">
<INPUT type="radio" id="radio0" father="radio0_lab" name="cnfpg" value="save"/>Modificar pagina</LABEL><BR/>
<LABEL id="radio1_lab" father="confPg">
<INPUT type="radio" id="radio1" father="radio1_lab" name="cnfpg" value="add2pg"/>Salvar pagina como</LABEL>
</DIV></BODY></html>"
CONTEXT: PL/pgSQL function "mdlreg" line 66 at SQL statement
In statement:
SELECT * FROM mdlreg('appgen', 'karinapp.com', 'dev', '186.120.130.244')

这是函数。

DECLARE regmoment TIMESTAMP;
DECLARE mdlid bigint;

DECLARE regid visitsmdl_reg%ROWTYPE;
DECLARE mdlcode pages_reg%ROWTYPE;
DECLARE mdNm modules_reg%ROWTYPE;


BEGIN
regmoment = CURRENT_TIMESTAMP;

SELECT modules_reg.id INTO mdlid
FROM domain_reg, sbdomain_reg,
modules_reg, sbdomdl_asc
WHERE(modules_reg.mdname = $1 AND
sbdomdl_asc.module = modules_reg.id AND
sbdomdl_asc.domain = sbdomain_reg.id AND
sbdomain_reg.domain = domain_reg.id AND
domain_reg.dname = $2 AND
sbdomain_reg.sbname = $3);

IF mdlid IS NULL THEN
SELECT modules_reg.id INTO mdlid
FROM domain_reg, sbdomain_reg,
modules_reg, sbdomdl_asc
WHERE(modules_reg.indexmdl = 't' AND
sbdomdl_asc.module = modules_reg.id AND
sbdomdl_asc.domain = sbdomain_reg.id AND
sbdomain_reg.domain = domain_reg.id AND
domain_reg.dname = $2 AND
sbdomain_reg.sbname = $3);
IF mdlid IS NULL OR mdlname != 'index' THEN
INSERT INTO visitsmdl_reg (module, regtime, machaddr) VALUES(3, regmoment, $4);

SELECT visitsmdl_reg.id, pages_reg.code
INTO regid, mdlcode
FROM modules_reg, visitsmdl_reg, pages_reg
WHERE(visitsmdl_reg.regtime = regmoment
AND modules_reg.id = 3
AND modules_reg.id = pages_reg.mdl);

RETURN (regid || mdlcode);

ELSE
INSERT INTO visitsmdl_reg (module, regtime, machaddr) VALUES(mdlid, regmoment, $4);

SELECT visitsmdl_reg.id, pages_reg.code, modules_reg.mdname
INTO regid, mdlcode, mdNm
FROM modules_reg, visitsmdl_reg, pages_reg
WHERE(visitsmdl_reg.regtime = regmoment
AND visitsmdl_reg.module = mdlid
AND modules_reg.id = mdlid
AND pages_reg.mdl = mdlid);


RETURN (regid || mdlcode || mdNm);

END IF;

ELSE


INSERT INTO visitsmdl_reg (module, regtime, machaddr) VALUES(mdlid, regmoment, $4);


SELECT visitsmdl_reg.id, pages_reg.code
INTO regid, mdlcode
FROM modules_reg, visitsmdl_reg, pages_reg WHERE(visitsmdl_reg.regtime = regmoment
AND visitsmdl_reg.module = modules_reg.id AND modules_reg.mdname = $1
AND modules_reg.id = pages_reg.mdl);


RETURN (regid || mdlcode);

END IF;
END;

提前致谢!

最佳答案

无论错误消息显示在哪一行,这里都是一个引发错误的简单示例。

CREATE TABLE issue_9000(f INTEGER);
INSERT INTO issue_9000 (f)
SELECT 'ABCDEFG';

以及 PGADMIN 的输出

ERROR:  invalid input syntax for integer: "ABCDEFG"
LINE 2: SELECT 'ABCDEFG';
^

********** Error **********

ERROR: invalid input syntax for integer: "ABCDEFG"
SQL state: 22P02
Character: 35

您试图将字符填充为整数,如评论的 a_horse_with_no_name。

关于postgresql - 返回多行的 PostgreSQL 函数的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5414678/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com