redash icon indicating copy to clipboard operation
redash copied to clipboard

Querying SQL tables with space in table names results into an error

Open gauiPPP opened this issue 3 years ago • 0 comments

This is kind of a feature request but basically a bug also: If the SQL table name has a space [ ] in it's name, the query results into an error.

Eg. SELECT * FROM dbo.Company Name$Store

=> Error running query: Invalid object name 'dbo.Company'.DB-Lib error message 20018, severity 16: General SQL Server error: Check messages from the SQL Server (anyone wondering: the table name model is from MS dynamics NAV and modifying table names is not the way to go)

The target table should have brackets, at least for SQL (server 2014 in my case). It would not hurt to have brackets also in other parts of the target name SELECT * FROM [dbo].[Company Name$Store]

If anyone would like to indicate what part of the code handles the creation of queries, I would like to look and test (with beginner level expertise) - it would also be useful if table field names would be inserted with a comma.

Technical details:

  • Redash Version: Version: 8.0.0+b32245 (a16f551e)
  • Browser/OS: Chrome 106.0.5249.119 (but this really is not a browser issue)
  • How did you install Redash: Local Ubuntu 18 VM and running the model script

gauiPPP avatar Oct 17 '22 07:10 gauiPPP