Version: 2.4 beta1 (Calligra 2.4 beta1) (using KDE 4.6.0) OS: Linux This bug was found while trying to import an ODS with a column name titled "desc". It seems "desc" is a reserved word, however there is no check, thus allowing the creation of the table. However trying to base a report on that table, displays an empty report. Reproducible: Always Steps to Reproduce: 1) Create a table with a field named "desc" OR 2) Try to import one from CSV with a field named "desc" OR 3) Try to import an ODS with a field named "desc" Actual Results: In cases 1, 2 the table is created successfully and can be browsed Trying to base a report on either of these tables, results an empty report. In case 3 Kexi crashes. Expected Results: User should be warned that "desc" cannot be used as a field name as it is a reserved keyword. This bug should be fixed, as "desc" if fairly common in field names and using it could cause trouble. Thanks to Adam for pinpointing it when importing.
The same happens with a column named "temp". WHOOPS, I found another reserved word? We should really to something about this, for starters why not publish somewhere a list of reserved words? We can worry fixing this later.
I can see another solution that we more or less have in initial stage in Kexi(DB): enclosing names in " " before sending them to database backends, including SQLite. SELECT * FROM "FROM"; could definitely work. Remaining question is: what if user writes SELECT * FROM FROM; in the SQL view. She's power user so she should consult the documentation for the list of reserved words (and Kexi can warn about this quite well). So for the latter case I agree that we can and should document reserved words for any backend in the documentation. Are you interested in helping with this? (I can guide you). Well, we can even have reserved_words property of KexiDB/Predicate driver that returns the list...
I strongly think we should abide by the standards. Having single or double quotes in field names could be even more confusing as quotes are used to pass text values to the Select statement. So I lean towards the reserved words document (in the web, Documentation and Kexi) I will be glad to do it (with proper guidance). We should talk the details at the IRC.
Using quotes in identifiers is a common practice in databases. Without this ability we would exclude too many common words what would be unexpected to users working with KexiSQL. We could auto-replace desc with _desc but replacing and requiring to replace with "desc" in KexiSQL (or [desc]?) would be a lot better - natural. Kexi handles the case in tables, queries and forms. A fix for reports is missing.
Git commit 03b862620657fc43c95782a719da9156f313a8cc by Jaroslaw Staniek. Committed on 08/03/2012 at 01:25. Pushed by staniek into branch 'master'. Reports: Fix crash in assigning data source that uses reserved words Reports *Fix crash in assigning data source that uses reserved words as field names **Tables/queries with reserved words still do not work in reports though M +4 -0 kexi/doc/dev/CHANGELOG-Kexi-js M +3 -1 kexi/plugins/reports/kexidbreportdata.cpp http://commits.kde.org/calligra/03b862620657fc43c95782a719da9156f313a8cc
Git commit 5458aeea78ab67e370b41ea9d5b2f3179ea869f6 by Jaroslaw Staniek. Committed on 08/03/2012 at 01:25. Pushed by staniek into branch 'calligra/2.4'. Reports: Fix crash in assigning data source that uses reserved words Reports *Fix crash in assigning data source that uses reserved words as field names **Tables/queries with reserved words still do not work in reports though Reviewed. M +4 -0 kexi/doc/dev/CHANGELOG-Kexi-js M +3 -1 kexi/plugins/reports/kexidbreportdata.cpp http://commits.kde.org/calligra/5458aeea78ab67e370b41ea9d5b2f3179ea869f6
Changing to a wish