¿Estoy loco o simplemente tonto?"la función no existe", pero realmente creo que sí
dev=# \df abuse_resolve
List of functions
-[ RECORD 1 ]-------+------------------------------------------------------------------------------------------------------------------------------------
Schema | public
Name | abuse_resolve
Result data type | record
Argument data types | INOUT __abuse_id bigint, OUT __msg character varying
Type | normal
dev=# select abuse_resolve('30'::bigint);
ERROR: function abuse_resolve(bigint) does not exist
LINE 1: select abuse_resolve('30'::bigint);
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Aquí está la CREATE FUNCTION
, he omitido la carne del código, pero que debería ser irrelevante:
CREATE OR REPLACE FUNCTION abuse_resolve(INOUT __abuse_id bigint, OUT __msg character varying) RETURNS record AS $_$
DECLARE
__abuse_status VARCHAR;
BEGIN
...snip...
UPDATE abuse SET abuse_status = __abuse_status,
edate = now(),
closed_on = now()
WHERE abuse_id = __abuse_id;
__msg = 'SUCCESS';
END;
$_$ LANGUAGE plpgsql SECURITY DEFINER;
Y sólo por diversión:
GRANT ALL ON FUNCTION abuse_resolve(INOUT __abuse_id, OUT __msg character varying) TO PUBLIC;
GRANT ALL ON FUNCTION abuse_resolve(INOUT __abuse_id, OUT __msg character varying) TO myuser;
Esa función se parece como existe. ¿Qué podría estar perdiendo?
Esto se resuelve, la respuesta es: soy tonto. Había definido incorrectamente los argumentos originalmente, pero mi código estaba usando los correctos. Hubo un extra bigint
que no tenía nada que hacer allí.
Se puede publicar la declaración 'crear function'? –
¿Ejecutaste ambos en la misma sesión? Mismo usuario? Misma ruta de búsqueda? –
Sí, solo hay un usuario. search_path se establece en public, SHOW lo confirma. Voy a editar con CREATE FUNCTION – echtish