snippetsqlMinor
How can prevent writes to a Postgres schema for a period of time?
Viewed 0 times
preventcanwritespostgresperiodtimeforhowschema
Problem
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?
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?
Solution
You can
REVOKE access from that schema, but I am affraid the application will have some unwanted effects. PostgreSQL has fine tuned permission administration. And later you can GRANT access to that schema.Context
StackExchange Database Administrators Q#82927, answer score: 3
Revisions (0)
No revisions yet.