4. In the range of real numbers, the solution set of the equation
$$
\left(x^{2}-x-1\right)^{x^{3}+2 x^{2}-9 x-18}=1
$$

is $\qquad$ .
4. $\{0, \pm 1, \pm 2, \pm 3\}$.

Discuss three possible cases.
(1) $x^{2}-x-1=1$, solving gives $x=-1,2$.
(2) $x^{2}-x-1=-1$, solving gives $x=0,1$, in this case, the exponent $x^{3}+2 x^{2}-9 x-18$ is even, so $x=0,1$ are both solutions to the original equation.
(3) $x^{3}+2 x^{2}-9 x-18=0$, and $x^{2}-x-1 \neq 0$, solving gives $x= \pm 3,-2$.
In summary, the solution set of the original equation is $\{0, \pm 1, \pm 2, \pm 3\}$.