3 ms·
Doesn't PostgreSQL support something like: RENAME TABLE current TO current_old, current_new TO current; Which is the common pattern of at
by avar 15y ago
Doesn't PostgreSQL support something like:
RENAME TABLE current TO current_old,
current_new TO current;
Which is the common pattern of atomically swapping out tables in MySQL with zero downtime.
- lentil 15y agoAlmost all DDL is transactional in PostgreSQL, so the usual equivalent to the above would be: begin; alter table current rename to current_old; alter table current_new rename to current; commit; Transaction-safe DDL is a very handy thing indeed.