Good example of a polynomial which produces a finite number of primes is: $$x^{2}+x+41$$ which produces primes for every integer $ 0 \leq x \leq 39$.
In a paper H. Stark proves the following result: $X_{n}$ (the ring of "algebraic integers" in $\mathbb Q(\sqrt{-n}))$ is a principal ideal domain for positive $n$ if and only if $n = 1,2,3,7,11,19,43,67,163. $ For a reference one can see:
Harold Stark, A complete determination of the complex quadratic fields of class-number one, Michigan Math J., 14 (1967) 1-27.
Consider in general the polynomial $x^{2}+x + K= (x+ \alpha)(x+ \bar{\alpha})$ which we can factorize where $\alpha$ is given by $$ \alpha = \frac{{1} + \sqrt{1-4K}}{2}, \quad \bar{\alpha} = \frac{1 - \sqrt{1-4K}}{2}.$$
One can get some relationships between polynomials which produce prime in the field $\mathbb Q(\sqrt{-n})$.
Question is if a polynomial produces a prime, then will $X_{n}$ as defined above be a PID?