24 Nov 2025 09:00 AM
I have written an extension to try to monitor the content of a table in a postgres DB.
However it looks as if im a bit stupid..
When i try to run my SQL directly against the DB it works.
However when i put it into my build extension, it fails.
Query has failed: ERROR: function date_subtract(date, unknown) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Why would it complain over date_subtract?
24 Nov 2025 11:52 AM
This dosent really explain why the SQL is not working.
24 Nov 2025 11:51 AM
I will try this, however my frustration is that, i do have a SQL that can execute directly against my postgress.
But it does not work with the extension build following DT sugestion.
I will give the "Now" way a shoot.
24 Nov 2025 10:42 PM
You query is NOT valid PostgreSQL dialect, I don't know how you are making this work with some other tool, there is no such thing as "date_subtract" in postgres.
It could be that someone created a custom function, but that is not going to be available from the extension, you will need to provide the schema name where that function is defined.
You can check if that is the case by running
SELECT
n.nspname as schema,
p.proname as function_name,
pg_get_function_arguments(p.oid) as arguments,
pg_get_functiondef(p.oid) as definition
FROM
pg_proc p
JOIN pg_namespace n ON p.pronamespace = n.oid
WHERE
p.proname = 'date_subtract';
Then you would modify the extension to use schema_name.date_subtract(...)