SQL: Error message for VALUES lists with different lengths
The following error message could likely be improved to something more like the one from Postgres.
$ super -version
Version: 7f23f6560
$ super -c "SELECT * FROM (VALUES (1, 2, 3), (1,2)) v1;"
values clause must contain uniformly typed values at line 1, column 34:
SELECT * FROM (VALUES (1, 2, 3), (1,2)) v1;
~~~~~
Details
Repro is with super commit 7f23f65. This was found via a query from a sqllogictest.
In Postgres the error instead looks like:
postgres=# SELECT * FROM (VALUES (1, 2, 3), (1,2)) v1;
ERROR: VALUES lists must all be the same length
LINE 1: SELECT * FROM (VALUES (1, 2, 3), (1,2)) v1;
^
Now, as someone that knows the SuperDB project, I can respect that our current error message about "uniformly typed values" can be seen through the lens of super-structured data, i.e., (1, 2, 3) and (1,2) end up being read and stored internally as different record types due to the differing number of primitive values in each. However, since the primitive values are all of the same type, I'm concerned this subtlety might elude a user coming from a SQL background such that they'd think they were seeing a bug. Therefore detecting the condition and providing an error similar to the one from Postgres may be appropriate.