I'd like for a client session to lock a table, so that it can continue to read from and write to that table. At the same time other client sessions should only be able to read from the table. Once the lock is removed, then all client sessions should be allowed to read from and write to the table. Also once the lock is removed, all client sessions that tried to write to the table while it was locked should execute. I don't want any errors thrown on attempted inserts during the lock.
I know that a read lock wouldn't work because the client session that creates the lock can't write to the table while the lock exists. Also a write lock wouldn't work because other client sessions can't read from the table. Is there any way for me to accomplish this?