Shaefer's Dichotomy Theorem
Primality testing is not of the form $\text{SAT}(S)$ for a finite set $S$ of finite-arity relations over the Boolean domain.  Thus, it's not covered by Shaefer's theorem, and Shaefer's theorem says nothing about the hardness of primality testing.  See this answer: https://cs.stackexchange.com/a/43831/755.

See also Why does Schaefer&#39;s theorem not prove that P=NP? for a more detailed explanation.