  We revisit the issue of superconductivity at the quantum-critical point (QCP)
between a 2D paramagnet and a spin-density-wave metal with ordering momentum
(\pi,\pi). This problem is highly non-trivial because the system at criticality
displays a non-Fermi liquid behavior and because the effective coupling
constant \lambda for the pairing is generally of order one, even when the
actual interaction is smaller than fermionic bandwidth. Previous study [M. A.
Metlitski, S. Sachdev, Phys.Rev.B 82, 075128 (2010)] has found that the
renormalizations of the pairing vertex are stronger than in BCS theory and hold
in powers of \log^2 (1/T), like in color superconductivity. We analyze the full
gap equation and argue that, for QCP problem, summing up of the leading
logarithms does not lead to a pairing instability. Yet, we show that
superconductivity has no threshold and appears even if the coupling is set to
be small, because subleading logarithmical renormalizations diverge and give
rise to BCS-like \log(1/T_c) \propto 1/\lambda. We argue that the analogy with
BCS is not accidental as at small coupling superconductivity at a QCP
predominantly comes from fermions which retain Fermi liquid behavior at
criticality. We computed T_c for the actual \lambda \sim 1, and found that both
Fermi-liquid and non-Fermi liquid fermions contribute to the pairing. The value
of T_c agrees well with the numerical results.
