Trying to delete records older than 1 month from 2 tables, where 1 refers to the id column in another:
create or replace function quincytrack_clean() returns void as $BODY$ begin month := interval '30 days'; delete from hide_id where id in (select id from quincytrack where age(QDATETIME) > month); delete from quincytrack where age(QDATETIME) > month; end; $BODY$ language plpgsql;
but this fails:
ERROR: syntax error at or near "month" LINE 1: month := interval '30 days' ^ QUERY: month := interval '30 days' CONTEXT: SQL statement in PL/PgSQL function "quincytrack_clean" near line 2
I am reading a document , but I donโt understand what is wrong with my declaration ...
plpgsql postgresql
Alexander farber
source share