I would like to add some fields to a table in all testing and production DBs, all of which are stored in PostgreSQL 9.3 on Amazon RDS.
ALTER TABLE users DROP COLUMN IF EXISTS device_language; ALTER TABLE users DROP COLUMN IF EXISTS device_name; ALTER TABLE users ADD COLUMN device_language character varying(3); ALTER TABLE users ADD COLUMN device_name character varying(3);
This snippet works without problems on my local database and on one of the testing databases, but hangs for a very long period on another DB and never runs the command.
I have stopped Apache (with all possible clients reading and writing from the DB), made the change and started Apache again, but this isn't a very elegant solution.
How can I know which connection is blocking the
ALTER TABLE command in a PostgreSQL database?