On 31 October 2017 at 13:36, <stefan.hanenberg@googlemail.com> wrote: > The following SQL statement leads to an error 42601 (syntax error), although > the error is not a syntax error.
> We are currently running automated tests on hundreds of thousands SQL in > order to check, what kind of errors they contain. It is really problematic > for us that the error is a 42601 error, although it seems rather as if it is > a type error.
then a syntax error seems a bit more reasonable.
Someone familiar with the SQL standard would need to confirm that our choice in this case is not governed by the standard before I'd consider changing it.
That said, I can make an argument for 42804 (datatype_mismatch) - which still has a syntax error classification - since the implicit row-types from the two input relations do not match each other.
The example error would read:
UNION types (int, int) and (int, int, int) cannot be matched