Cannot Restore Database From Dump

Both versions of Postgres are 17.5, both versions of Akkoma are 2025.03-2

I’m testing restoring from a db dump to prepare for moving my instance; I’m trying to follow the process in the docs and getting a dump is easy enough:

pg_dump -h localhost -U akkoma -d akkoma --format=custom -f akkoma.pgdump

But when I try to restore the dump I get an error:

psql -h localhost -U postgres -c "DROP DATABASE akkoma;"
psql -h localhost -U postgres -c "DROP USER akkoma;"
psql -h localhost -U postgres -c "CREATE USER akkoma WITH ENCRYPTED PASSWORD 'hunter2';"
psql -h localhost -U postgres -c "CREATE DATABASE akkoma OWNER akkoma;"
pg_restore -h localhost -U postgres -d akkoma -v -1 akkoma.pgdump

[...]

pg_restore: WARNING:  error during JITing: Permission denied
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 4589; 2606 17477 FK CONSTRAINT hashtags_objects hashtags_objects_object_id_fkey akkoma
pg_restore: error: could not execute query: ERROR:  failed to look up symbol "evalexpr_0_0": Failed to materialize symbols: { (main, { evalexpr_0_2, evalexpr_0_8, evalexpr_0_0, evalexpr_0_3, evalexpr_0_5 }) }
CONTEXT:  SQL statement "SELECT fk."object_id" FROM ONLY "public"."hashtags_objects" fk LEFT OUTER JOIN ONLY "public"."objects" pk ON ( pk."id" OPERATOR(pg_catalog.=) fk."object_id") WHERE pk."id" IS NULL AND (fk."object_id" IS NOT NULL)"
Command was: ALTER TABLE ONLY public.hashtags_objects
    ADD CONSTRAINT hashtags_objects_object_id_fkey FOREIGN KEY (object_id) REFERENCES public.objects(id) ON DELETE CASCADE;

Since I haven’t gotten to start the new Akkoma server yet I don’t think the issue is migration-related, does anyone have an idea on how to solve this?

Try creating all required extensions before starting the restore and if that doesn’t help, try running the restore with JIT disabled (using postgres config file and then restarting postgres) to rule out a JIT bug(/hardware mismatch) or at least get a clearer error message

Currently needed extensions are iiinm:

CREATE EXTENSION IF NOT EXISTS citext;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

Creating the extensions beforehand didn’t help but disabling JIT got the restore to finish, thanks

IDK how there could be a JIT bug between the same version of the database on both sides, I’d be surprised if going from kvm to virtualbox caused it but computers do love to find a way to break on me