A sandwich theorem for local rings The following question seems natural to ask in view of this question and its comments/answers:
Let $R \subseteq S$ be commutative Noetherian rings, let $q$ be a maximal ideal of $S$,
$p$ a maximal of $R$ and $p=R \cap q$.
The localization of $R$ at $p$, $R_p$, is a local ring with unique maximal ideal $pR_p$ and
the localization of $S$ at $q$, $S_q$, is a local ring with unique maximal ideal $qS_q$.
Since $p=R \cap q$, we can view $R_p$ as a subring of $S_q$.
Let $pS \subseteq I \subseteq q$ be an ideal of $S$ (not necessarily prime),
and then $I_q \subseteq S_q$ is an ideal of $S_q$ (where $I_q:=IS_q$).
Assume that $(pR_p)S_q = I_q = qS_q$,
where $(pR_p)S_q$ is the ideal of $S_q$ generated by $pR_p$ (this makes sense, since
$pR_p \subset R_p \subseteq S_q$).

Question: Is it true that $I=q$?
If not, would it help to further assume one or more of the
following conditions:
(i) $R \subseteq S$ is flat.
(ii) $R \subseteq S$ is integral.
(iii) $\dim(R)=\dim(S) < \infty$ ($\dim$ is Krull dimension).
(iv) $R$ and $S$ are regular rings.

Remark: The name 'sandwich' comes from the assumption
that $(pR_p)S_q = I_q = qS_q$; call it 'the sandwich equation'.
A non-counterexample: Without condition (iii), the following is not a counterexample: $R=k[x]$, $S=k[x,y]$, $p=(x)$, $q=(x,y)$, $I=(x(x-1),y)$.
Indeed, the sandwich equation is not satisfied: only the right equality is satisfied, but not the left equality.
Any hints and comments are welcome! Thank you.
 A: No. Let $R$ is the ring of integers of a number field $K$, $p$ be a nonzero prime ideal, $S$ be the ring of the integers of $K(e^{2i\pi/r})$ where $r$ is a prime number coprime to $r$ with $r-1 > [K:\mathbb{Q}]$.
Let $q$ be any prime ideal of $S$ lying over $p$: then $K(e^{2i\pi/r})/K$ is unramified at $p$ thus $(pR_p)S_q=qS_q$. So if $I$ is any ideal of $S$ with $pS\subset I \subset q$, $I_q=qS_q$ too.
If the statement holds, then it follows (by characterization of prime ideals from Dedekind domains, else we can take eg $I=qq’$, where $q’$ is another prime ideal of $S$ lying over $p$) that $pS=q$, thus that $p$ is inert in $K(e^{2i\pi}/r)$, and this certainly isn’t systematic – the final part gives an elementary example.
Now, assume $K=\mathbb{Q}$: even in this setting where (i),(ii),(iii),(iv) all hold, $p$ is inert in $K(e^{2i\pi/r})$ iff $S/pS$ is an integral domain, iff $\mathbb{Z}[e^{2i\pi/r}]/(p)$ is a domain, iff $\mathbb{Z}[T]/(\Phi_r,p)$ is a domain, iff $\Phi_r$ is irreducible in $\mathbb{F}_p[T]$.
Now fix $r > 3$ and choose $p$ congruent to $1$ mod $r$, then $\Phi_r|X^r-1|X^{p-1}-1$ which is split with simple roots in $\mathbb{F}_p[T]$, so that $\Phi_r$ cannot be irreducible and thus $p$ isn’t inert and we can find a “problematic” ideal $I$.
