What's happening if one of concurent lock on a table rename the locked table? I've hundred of insert as following each minutes:

BEGIN ISOLATION LEVEL SERIALIZABLE;

  INSERT INTO table1 VALUES (...);

COMMIT;


And I've the following transaction which will occured once:

BEGIN ISOLATION LEVEL SERIALIZABLE;

  LOCK TABLE table1 IN ACCESS EXCLUSIVE MODE;

  /* Rename the locked table */
  ALTER TABLE table1 RENAME TO table1_renamed;

  /* And I recreate the table */
  CREATE TABLE table1 (
    ...
  );

COMMIT;


The second transaction will blocked all INSERTs until it commits.

When it commits, will inserts be proceed on the new table1 or on the renamed one?

In other world are locks acquired on object's name (so it's resilient on rename operation) or on object's reference?
The objects id (oid) at the time the statement is prepared and executed. Pg_locks doesn't even store the relations name.

        View "pg_catalog.pg_locks"
       Column       |   Type   | Modifiers 
--------------------+----------+-----------
 locktype           | text     | 
 database           | oid      | 
 relation           | oid      | 
 page               | integer  | 
 tuple              | smallint | 
 virtualxid         | text     | 
 transactionid      | xid      | 
 classid            | oid      | 
 objid              | oid      | 
 objsubid           | smallint | 
 virtualtransaction | text     | 
 pid                | integer  | 
 mode               | text     | 
 granted            | boolean  | 
 fastpath           | boolean  |