There is a general (mis)conception that
$$\int \frac{1}{x} \, \mathrm{d}x = \ln|x| + C \label{1} \tag{1}$$
However, taking the indefinite integral as the set of all functions whose derivative is $\frac{1}{x}$, the technically correct answer should be
$$\int \frac{1}{x} \, \mathrm{d}x = \begin{cases} \ln(x) + C & \text{if $x > 0$} \\ \ln(-x) + D & \text{if $x < 0$} \end{cases} \label{2} \tag{2}$$
See Your calculus prof lied to you (probably) for more details.
Is $\eqref{2}$ correct and is $\eqref{1}$ incorrect? Or are they both acceptable?
I suppose $\eqref{2}$ is more correct but it perhaps doesn’t have any additional value compared to $\eqref{1}$ as the definite integral will give the same result for both (as the integral diverges if we move from the negative to positive $x$-axis).
Is there any other example where failing to define a piecewise function (with separate constants) as an integral can have serious consequences?