Only a piece that can move any number of squares along a horizontal, vertical, or diagonal line (i.e. a bishop, rook, or queen) can pin.
In this case it is illegal to move the pinned piece out of the line of attack, as that would place one's king in check (see diagram).
The pawn is a more complex case; due to its limited and conditional movement, whether a pin on a pawn is partial depends on the line and direction of the pin and on whether there are opposing pieces available for it to capture.
Using a battery of doubled rooks with a queen behind them to this end is known as Alekhine's gun.
The diagram shows Vladimir Lenin–Maxim Gorky, Capri 1908,[2] with White to move.
[3] Black is threatening the following rook sacrifice and forced mate: White cannot play 27.gxh3, because the queen on g3 is pinning the pawn to the g-file.
The only move that postpones the mate is 27.Nf4, which temporarily blocks Black's bishop from protecting his queen, but to no avail as Black can simply play 27...Bxf4 renewing the mate threat.
Or, Black can respond by mating a different way: In this case, White cannot capture 29.gxf3 because the queen now on h2 pins the pawn to the 2nd rank.