Help with the posterior of a uniform distribution with a parameter that is uniformly distributed Here is the question:

My main issue is with the marginal distribution of θ, I know that the sampling distribution is 1/(θ^n), but what interval do we integrate on, it can't be [0, 1] because that would give an error with 1/0, but I can't figure it out.
 A: Your statement of the sampling density is incorrect, since it does not take account of the bounds of the distribution.  (This is a common error for novices working with problems involving bounded distributions.  You will find the same error in many questions involving the uniform distribution on this site.)  Taking account of the bounds of the distribution, the correct sampling density is:
$$\begin{aligned}
p(\mathbf{x}_n|\theta) 
&= \prod_{i=1}^n p(x_i|\theta) \\[6pt]
&= \prod_{i=1}^n \frac{\mathbb{I}(0 \leqslant x_i \leqslant \theta)}{\theta} \\[6pt]
&= \frac{\mathbb{I}(0 \leqslant x_{(1)} \leqslant x_{(n)} \leqslant \theta)}{\theta^n}. \\[6pt]
\end{aligned}$$
(In this equation I have used the standard notation for order statistics.)  So, assuming you have a valid sample (i.e., with $0 \leqslant x_{(1)} \leqslant x_{(n)} \leqslant 1$) you should get the posterior density kernel:
$$\begin{aligned}
\pi(\theta|\mathbf{x}_n) 
&\propto p(\mathbf{x}_n|\theta) \cdot \pi(\theta) \\[12pt]
&\propto \frac{\theta \geqslant x_{(n)}}{\theta^n} \cdot \mathbb{I}(0 \leqslant \theta \leqslant 1) \\[6pt]
&\propto \frac{1}{\theta^n} \cdot \mathbb{I}(x_{(n)} \leqslant \theta \leqslant 1). \\[6pt]
\end{aligned}$$
The corresponding posterior density is obtained by finding the normalising constant by integrating the density kernel over its range.  Observe that the posterior density has support on the interval $x_{(n)} \leqslant \theta \leqslant 1$, which is the appropriate range ensuring that all the observed data are no greater than $\theta$.
