Search code examples
postgresqldatabase-restore

ERROR: syntax error at or near "FUNCTION" while db restoring


I have an error while restoring DB from dump. What does it mean?

ERROR:  syntax error at or near "FUNCTION"
LINE 1: ...LETE ON public.currency_rate FOR EACH ROW EXECUTE FUNCTION p...


--
-- Name: currency_rate currency_rate_bt_delete; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER currency_rate_bt_delete 
INSTEAD OF DELETE ON public.currency_rate 
FOR EACH ROW 
EXECUTE FUNCTION public.currency_rate_bt_delete();

Solution

  • The problem of your dump/restore is that your create dump with PostgreSQL v13 It generates dump you have shown.

    But then you try to restore this dump on PostgreSQL v10 which does not understand that dump