I'm wondering if I can/should expect schema renames to be isolated.

For example, I have two schemas "test" and "test_new". Each with a "test"
table (with same columns, but different data).

In one transaction I'm renaming the schemas test => test_old, test_new =>
test. I.e.:

BEGIN;
ALTER SCHEMA test RENAME TO test_old;
ALTER SCHEMA test_new RENAME TO test;
COMMIT;

In another transaction I do:

BEGIN;
SELECT * FROM test.test;
<first transaction occurs here on a different session>
SELECT * FROM test.test;
COMMIT;

My expectation is that both "SELECT" would return the same data (or that
the transaction performing the rename is blocked until the select
transaction is complete).

In testing this on 9.5.7 the behaviour I see is that the select "SELECT"
returns different data. (Regardless of isolation level chosen).

Is it possible to perform this rename in any way?

If not (which I suspect is the case) is this documented somewhere, I
couldn't find it (but that is probably me not looking hard enough / in the
right place).

Thanks,

Ben

Reply via email to