A tip for pgAdmin: Reusing related SQL queries? separate with semicolon; at the end of each statement. Then use -- at the start of a statement to comment it out. Much better than using query history for many tasks, e.g. UPDATE, SELECT, UPDATE again etc...