Migration errors
Fix: psql "invalid command \restrict" when importing a dump
invalid command \restrict When it happens
Importing a dump produced by pg_dump 16.10/17.6+ with an older psql client.
Why it happens
The 2025 PostgreSQL security releases added \restrict guard lines to dumps. Older psql clients don't recognize the meta-command and abort.
How to fix it
1. Upgrade psql to a 2025+ minor release
psql --version # needs >= 16.10 / 17.6 2. Or strip the guard lines (safe for trusted dumps)
grep -v '^\\restrict\|^\\unrestrict' dump.sql > dump.clean.sql 3. Files from our converter
are already free of \restrict lines, so they import with any psql version.
Migrating between MySQL and PostgreSQL?
Our converter handles this and dozens of other gotchas automatically — upload a dump, download working SQL.
Try the converter free