Definitions of position operator in QM We define the position operator $\hat{X}$ by 
$$\hat{X}|\psi\rangle := \bigg(\int dx |x \rangle x \langle x | \bigg) | \psi \rangle \tag{1}$$ 
for some state vector $| \psi \rangle \in \mathcal{H}$. We also have the state vector $| \psi \rangle$ in the position basis given by $\psi(y) = \langle y | \psi \rangle$. Then 
\begin{align}
(\hat{X} \psi)(y) & := \langle y | \hat{X}| \psi \rangle = \int dx \langle y | x \rangle x \langle x | \psi \rangle = \int dx \delta(y-x)x \psi(x) 
\\ & = y \psi(y) \int dx \delta(y-x) = y \psi(y).\tag{2}
\end{align}
As I understand, one postulate of QM states that for any observable $\hat{A}$ we have that $$\hat{A} | \psi \rangle = a_n | \psi_n\rangle\tag{3}$$ where $a_n$ is some eigenvalue and $| \psi_n \rangle$ the corresponding eigenvector. For the position operator we thus have $$\hat{X} | \psi \rangle = x |x \rangle\tag{4}$$ where $x$ is some eigenvalue and $| x \rangle$ is the eigenvector of the position operator, therefore $$\langle y | \hat{X} | \psi \rangle = x \langle y | x \rangle = y \delta(y -x).\tag{5}$$ Therefore $$y\psi(y) = y\delta(y-x).\tag{6}$$ But then this implies that the state which we started with $| \psi \rangle$ is $$\psi(y) = \delta(y-x),\tag{7}$$ but this should be the state only after the position measurement. Why do these definitions of the position operator not agree?  
 A: It is not the case that
$$
\newcommand{\ket}[1]{\left| #1 \right\rangle}
\hat{A} \ket{\psi} = a_n \ket{a_n}
$$
where $\hat{A}$ is an observable, $a_n$ is an eigenvalue, and $\ket{a_n}$ is the corresponding eigenvector. You are getting confused with collapsing the wavefunction, which says that a measurement of the observable $\hat{A}$ results in the wavefunction collapsing to a particular eigenstate $\ket{a_n}$ if the value $a_n$ is measured, which is not the statement you have written. (The statement you've written is an equality--it doesn't tell you anything about a process occurring.) 
What is true is that:
$$
\hat{A} \ket{a_n} = a_n \ket{a_n}
$$
which is the definition of an eigenvector. Therefore, since we can write $\ket{\psi}$ in the $\hat{A}$ basis:
$$
\hat{A} \ket{\psi} = \int \mathrm{d} {n} \ \hat{A} \psi_n \ket{a_n} = \int \mathrm{d}n \ a_n \psi_n \ket{a_n}
$$
Or, for $\hat{X}$:
$$
\left\langle{y} \hat{X} \right\rangle{\psi} = \int \mathrm{d} x \ x \psi(x) \left\langle{y} | x \right\rangle = \int \mathrm{d} x \ x \psi(x) \delta(y - x) = y \psi (y)
$$
Now, to address the incorrect postulate you claimed. We do not use the application of the observable $\hat{X}$ to represent the collapse of the wavefunction. After all, consider $\ket{\psi} = \ket{x_1} + \ket{x_2}$. Applying $\hat{X}$ to this sum of eigenvectors yields...another sum of eigenvectors, by linearity. You have to introduce the measurement result somehow--else how do you know which $x$ you get? 
If you are given a wavefunction prior to a measurement and then given a measurement outcome, you should instead use the corresponding projection operator to project the wavefunction onto the measured eigenvector:
$$
\ket{\psi} \to P \ket{\psi} =  \left( \ket{x_1} \left\langle x_1 \right| \right) \ket{\psi}
$$
assuming that $x_1$ was measured. This can be more complicated if the eigenvalues are degenerate, in which case you will collapse instead to the subspace of eigenvectors associated with that eigenvalue.
