Situation 1: a hanging (pendant) lamp on a pipe
In that case you use aa slip ring.
You place this on the pipe, just below the ceiling cap.
Connect the lamp, then slide the ceiling cap tightly against the ceiling.
Slide the slip ring tightly against the ceiling cap and tighten the (small) bolt in the slip ring.
Situation 2: a pendant (hanging) lamp on a chain
In this case, the last link of the chain is (usually) attached to an adjustment pipe.
Or a hanging loop that is attached to a rod.
Anyway, do the same as in situation 1, see above, use a slip ring.
Situation 3: a pendant (hanging) lamp on a cord
In this case, use a strain relief to get the ceiling cap tight against the ceiling.
In this case, certainly do not use an adjusting ring.
Why not: because you don't want to tighten a metal bolt on a cord, it can cause a short circuit. In this case, use a strain relief!
Furthermore, you follow the same steps as in situation 1, but now with a strain relief.