datacamp / sqlwhat

https://sqlwhat.readthedocs.io
GNU Affero General Public License v3.0
3 stars 8 forks source link

Dialect specific handling of case sensitivity #85

Open machow opened 7 years ago

machow commented 7 years ago

Currently, to workaround tsql issues...

  1. AST representations are converted to lowercase
  2. Column names are converted to lowercase

In postgres, these are not issues because unquoted column names should be made lowercase in the AST (as the official parser does). This also means that column names tend to be lowercase, too. Using casing is possible, though, so we don't want to convert everything to lowercase for postgres.

filipsch commented 6 years ago

As a sidenote (without completely understanding the entire context and history), I noticed that AS and as for aliasing are treated differently in postgresql, while they shouldn't.

machow commented 6 years ago

I'm not sure I understand, but in case it helps, it looks like table aliases aren't converted to an alias node (but are Unshaped). In this case the "AS" keyword is stored as written, which might be causing the casing issues?

image

filipsch commented 6 years ago

@machow, yup, that must be it. Thanks for the pointer.