call apoc.custom.asProcedure('test_ghost','RETURN 100 as result')
register a procedure with the same name:
call apoc.custom.asProcedure('test_ghost','RETURN $count as result','read',[['result','int']],[['count','int']])
check the registered procedure:
call apoc.custom.list
type
name
description
mode
statement
inputs
outputs
forceSingle
1
"procedure"
"test_ghost"
""
"read"
"RETURN $count as result"
[["count", "integer"]]
[["result", "integer"]]
null
run 'test_ghost' with parameter:
call custom.test_ghost(15)
--
1 | 15
- run 'test_ghost' without parameter:
call custom.test_ghost
--
1 | { "result": 100 }
- remove procedure
call apoc.custom.removeProcedure('test_ghost')
- run 'test_ghost' without parameter still get the result
call custom.test_ghost
--
1 | { "result": 100 }
- run 'test_ghost' with parameter get the error
call custom.test_ghost(15)
There is no procedure with the name custom.test_ghost registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
Seems only the last registered procedure is removed, the 'overwritten' one is still somewhere functioning.
Reported by @cg122 in https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/1555#issuecomment-815208614
I am using neo4j from docker, with neo4j:latest (4.2.4):
From neo4j browser:
-- 1 | 15
call custom.test_ghost
-- 1 | { "result": 100 }
call apoc.custom.removeProcedure('test_ghost')
call custom.test_ghost
-- 1 | { "result": 100 }
call custom.test_ghost(15)
There is no procedure with the name
custom.test_ghost
registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.