A protective railing includes a frame, a railing body, a lockset, two fix unit and plural position members. The position members secure the frame to a doorframe or in a passageway. If the railing body is to be opened, a push button on a grip is shifted to move a deadbolt inward to separate from an insert hole of the railing body, and then the grip is pressed down to move up a rack together with a connect tube, with a stop block of the rack and the connect tube separate from between two stoppers of the fix unit, unlocking the lock set to let the railing body opened. To lock the lockset, after the railing body is closed, the push button is shifted outward to move the deadbolt to insert in the insert hole of the raining body, finishing locking process.