The LCO Magnetic Media is creating a foreign key with ad_sequence table - this creates a lock (probably changes in the latest postgresql database) because the statement
creates a lock on the whole AD_Sequence table - and then when trying to get a next id sequence is locked.