I created a new age_date()
function using the following SQL and C code:
SQL:
CREATE FUNCTION ag_catalog.age_date()
RETURNS cstring
LANGUAGE c
STABLE
PARALLEL SAFE
AS 'MODULE_PATHNAME';
C Code:
Datum age_date(PG_FUNCTION_ARGS) {
// Program Logic
}
After stopping and restarting the server, I attempted to run this function within a cypher query. However, I encountered an error stating that the function does not exist.
5
Answers
Try
make distclean
on age and then re-install it. After that load it again in postgres and try againWhen modifying the C code, the changes will take effect immediately upon restarting the server. However, when altering the SQL file, a server restart is required, along with dropping and recreating the extension.
Execute the following commands:
DROP EXTENSION age;
Restart the server
CREATE EXTENSION age;
LOAD ‘age’;
SET search_path TO ag_catalog;
I hope this resolves the issue.
You have to run make install again after changing anything in the repo like adding or modifying functions for them to take effect.
Further you should run install check as well to see if it breaks anything.
Then as pointed out in other answers, you have to drop the extension and reload it.
Hope this helps!
It could be a number of reasons.
Did you compile and reinstalled the extension?
It could be that you forgotten the function registration above the function:
Either that, or you may be calling the function wrongly, which should be
Also, you may need to drop extension and creating it again if you altered the .sql file.
Please add more details so we can help you more assertively.
If you are writing function in new "C" file then you need to modify "MAKEFILE" as well.
Here is what to do:
Next, "clean" & "install" it again:
Reference: https://dev.to/rrrokhtar/guide-to-age-contribution-and-modifying-the-source-code-to-add-new-functions-l7m