I discuss the interplay between non-Fermi liquid behaviour and superconductivity near a quantum-critical point (QCP) in a metal. The tendencies towards superconductivity and non-Fermi liquid behaviour compete: fermionic incoherence destroys the Cooper logarithm, while superconductivity eliminates scattering at low energies and restores fermionic coherence. I argue the tendency towards pairing wins, but the competition with non-Fermi liquid necessary leads to pseudogap behaviour in the temperature range between the onset of the pairing at Tp and the actual superconducting Tc. I argue that there are two pseudogap regimes. In some range below Tp the pairing is induced by fermions with the lowest Matsubara frequencies wm = +- p T, for which fermionic self- energy is parametrically smaller than at other wm. I argue that in this regime superfluid stiffness is parametrically smaller than T, and superconducting order is destroyed by long-wavelength phase fluctuations. At smaller T, but still at T > Tc, superconducting coherence is lost due to phase slips, associated with the presence of a discrete, infinite set of solutions for the gap function at T=0. I argue that there is a physically relevant model, in which this set becomes a continuous one, and long-range superconducting order is destroyed already at T=0. I discuss the behaviour of observables in the pseudogap regime and show that, e.g., the gap in the density of states fills in as T increases towards Tp, instead of closing.