PDA

View Full Version : QSqlTableModel + PSQL is unable to find table (due to casing)



gvd
2nd February 2010, 17:56
Hi,

I was using Qt 4.4.3 before and switched to 4.6.1. Now my tables are unable to load from Postgres. I figured out this is because the upper-case letters are being ignored when doing a select() or submitAll(). When I change all the table names to lower-case everything works fine. This problem doesn't occur with SQLite. In 4.4.3 it all worked fine. What changed? Is it possible to make it work with both lower and uppercase table names?

tangential
3rd February 2010, 06:01
What changed is the casing rules. We tried to be less proactive in figuring out what the programmer meant, and more "the programmer understands what he wants". In this case, postgresql is taking the lowercase as "ignore casing", so you got a bit lucky there (same with the old code). If you want to use exact casing, try placing quotes around the table name.

The underlying problem is that different db engines have vastly different meanings for unquoted names and case sensitivity. Rather than continuously getting it wrong (and special casing all over the place), we simplified, and let the database do what it does with unquoted, and leave it to the programmer to get it right (quote it if you're really concerned with case sensitivity).

Hope this helps.