I am moving a schema from one server to another using pg_dump + pg_restore + drop schema cascade. I need to know that no applications are writing to it (or at least that the writes will fail) during this process to avoid losing data.
At the moment I am renaming the schema before starting the dump. Is that sufficient to prevent writes? What if a large batch insert is busy when I rename the schema? Will that still complete?