I want to run this code but got this error
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
execute $$SELECT MAX(date) FROM $$||table_name INTO datum;
IF datum is not NULL THEN
execute $$DELETE FROM $$||table_name||$$ WHERE date >= $$||quote_literal(datum);
ELSE
datum := $$2001-01-01$$;
end if;
execute $$
INSERT INTO $$||table_name||$$
(number, date, departement, minutes)
select
number, gs.date,
where (beg, enddate) overlaps (concat($$||quote_literal(datum)||$$, '00:00:00'), concat($$||quote_literal(datum)||$$, '23:59:59'))
Let's notice also that where (beg, enddate) overlaps (concat($$||quote_literal(datum)||$$, '00:00:00'), concat($$||quote_literal(datum)||$$, '23:59:59')) want to do it only when datum != $$2001-01-01$$; (not for the first iteration).
Thank you,
||is enough.||is already a concatenation operator, which concatenates. So, you won't need to use concat additionally. Read more here postgresql.org/docs/9.1/functions-string.htmldatum?