zio-sql icon indicating copy to clipboard operation
zio-sql copied to clipboard

Mysql: Function 'Lower' treats string literals as column names

Open TobiasPfeifer opened this issue 3 years ago • 3 comments

As shown at https://www.w3schools.com/sql/trymysql.asp?filename=trysql_func_mysql_lower the Lower function should not treat string literals as column names.

currently select(Lower("LOWER")) from customers limit(1) fails with java.sql.SQLSyntaxErrorException: Unknown column 'LOWER' in 'field list' when executed against the test schema.

  1. It should yield lower (SELECT lower("LOWER") instead of SELECT lower(LOWER))
  2. It should type check the columns used in Lower are available in the table

I encountered this when cleaning up the tests in #427 There is a test case available for this issue: https://github.com/zio/zio-sql/pull/427/files#diff-b69ce48bd3431d7cb54603c42a17ece5658336b82acfb54a29098672c96ee04fR26

TobiasPfeifer avatar Apr 09 '21 17:04 TobiasPfeifer

I'd like to tackle this if no one else is working on it.

naderghanbari avatar May 15 '21 01:05 naderghanbari

This actually applies not only to mysql but to all dialects.

naderghanbari avatar May 20 '21 02:05 naderghanbari

This is still an open issue

sviezypan avatar Feb 23 '22 22:02 sviezypan