Postgresql postgres-错误:语法错误位于或接近;“成本”;

Postgresql postgres-错误:语法错误位于或接近;“成本”;,postgresql,function,Postgresql,Function,EDIT take COST 100 out使命令通过,但是,我仍然无法运行我的查询,因为它会产生以下错误: ERROR: function group_concat(character) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. 我正在运行的查询是: select tpid, group_conca

EDIT take COST 100 out使命令通过,但是,我仍然无法运行我的查询,因为它会产生以下错误:

ERROR:  function group_concat(character) does not exist
HINT:  No function matches the given name and argument types. You may need to add explicit type casts.
我正在运行的查询是:

select tpid, group_concat(z) as z,                                                                                                                                                    
    group_concat(cast(r as char(2))) as r,                                                                                                                                   
    group_concat(to_char(datecreated,'DD-Mon-YYYY HH12:MI am')) as datecreated,                                                                                                        
    group_concat(to_char(datemodified,'DD-Mon-YYYY HH12:MI am')) as datemodified                                                                                                       
    from tpids group by tpid order by tpid, zip
此函数在本地似乎运行良好,但将其联机会产生此错误。。。有什么我遗漏的吗

CREATE OR REPLACE FUNCTION group_concat(text, text)
  RETURNS text AS
$BODY$
SELECT CASE
WHEN $2 IS NULL THEN $1
WHEN $1 IS NULL THEN $2
ELSE $1 operator(pg_catalog.||) ',' operator(pg_catalog.||) $2
END
$BODY$
  LANGUAGE 'sql' IMMUTABLE
  COST 100;
ALTER FUNCTION group_concat(text, text) OWNER TO j76dd3;

提示消息指出,您的存储过程缺少一个参数。它需要2个参数,但在列stations中:

group_concat(cast(r as char(2))) as r,
group_concat(to_char(datecreated,'DD-Mon-YYYY HH12:MI am')) as datecreated,
group_concat(to_char(datemodified,'DD-Mon-YYYY HH12:MI am')) as datemodified        
你们只提供一个

因为PostgreSQL 8.4允许参数的默认值。有关更多信息和示例,请参阅