Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. BEGIN;
  2. -- You probably want to make sure that no one else is
  3. -- INSERT / UPDATE / DELETE'ing from the original table, otherwise
  4. -- those changes may be lost during this switchover process. One way
  5. -- to do that would be via:
  6. -- LOCK TABLE "table" IN ROW EXCLUSIVE mode;
  7. CREATE TABLE "table_new" (LIKE "table");
  8. INSERT INTO "table_new" ...;
  9.  
  10. -- The ALTER TABLE ... RENAME TO command takes an Access Exclusive lock on "table",
  11. -- but these final few statements should be fast.
  12. ALTER TABLE "table" RENAME TO "table_old";
  13. ALTER TABLE "table_new" RENAME TO "table";
  14. DROP TABLE "table_old";
  15.  
  16. COMMIT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement