AnyhowStep / sql-compiler

An experimental SQL compiler
MIT License
0 stars 0 forks source link

Meta: Stop using db-fiddle to test for esoteric features/surprising results #15

Open AnyhowStep opened 3 years ago

AnyhowStep commented 3 years ago

db-fiddle is good for testing widely-used features.

It is terrible for testing esoteric stuff. It is an abstraction for querying multiple types of DBs.

More than once, you've been bitten by using db-fiddle when you have a perfectly running local instance of MySQL...

For example,

SELECT @@/**/sql_mode;

The above is valid on db-fiddle, querying their MySQL DB.

It is definitely invalid on MySQL.


This suggests db-fiddle does some pre-processing which strips multi-line comments. And, indeed, they do. They completely ignore execution comments/hidden commands.

SELECT 1/*!test*/; -- Equivalent to SELECT 1 AS test
The result on db-fiddle, 1
1
The result on MySQL, test
1
AnyhowStep commented 3 years ago

There are probably a dozen other similar cases unrelated to multi-line/execution comments that you've forgotten.

AnyhowStep commented 3 years ago

db-fiddle is convenient. This does not make db-fiddle results correct.

AnyhowStep commented 3 years ago

Another good example,

SELECT 1, 1
Db-fiddle result, 1
1
MySQL result, 1 1
1 1

DB-fiddle seems to merge duplicate columns.

SELECT 1, 2 AS `1`;
Db-fiddle result, 1
2
MySQL result, 1 1
1 2