Using Tora 2.1.3 on both Windows 7 and Ubuntu 11.10. PostgreSQL 9.0.4 on RHEL5.
Schema browser works great but when I click on the "Data" tab after selecting a table, I get errors similar to the following:
Wed Jan 11 03:34:08 2012
ERROR: relation "public.mixed_case_table" does not exist
LINE 1: SELECT * FROM public.Mixed_Case_Table
^
Query not active SELECT * FROM public.Mixed_Case_Table
Obviously the table name should be quoted as Postgres automatically converts unquoted names to lowercase.
I have an identical table structure (mixed case names) in an Oracle database (11.2g), and Tora can browse the data just fine. I've looked at the SQL it generates for oracle and it is properly quoting the mixed case names.
I looked at the Postgresql specific source in toqsqlconnection.cpp, but I can't see why this would work in Oracle but not Postgres.
toqsqlconnection.cpp (Postgres Code)
1502 virtual QString quote(const QString &name)
1503 {
1504 if (connection().provider() == "PostgreSQL")
1505 {
1506 bool ok = true;
1507 for (int i = 0;i < name.length();i++)
1508 {
1509 if (name.at(i).toLower() != name.at(i) || !toIsIdent(name.at(i)))
1510 ok = false;
1511 }
1512 if (!ok)
1513 return QString::fromLatin1("\"") + name + QString::fromLatin1("\"");
1514 }
1515 return name;
1516 }
tooracleconnection.cpp (Oracle Code)
646 virtual QString quote(const QString &name, const bool quoteLowercase)
647 {
648 bool ok = true;
649 // Identifiers starting with digit should be quoted
650 if (name.at(0).isDigit())
651 ok = false;
652 else
653 for (int i = 0; i < name.length(); i++)
654 {
655 if ((name.at(i).toUpper() != name.at(i) && quoteLowercase) || !toIsIdent(name.at(i)))
656 ok = false;
657 }
658
659 // Check if given identified is a reserved word
660 int i = 0;
661 while (ok && (DefaultKeywords[i] != NULL))
662 {
663 if (name.compare(DefaultKeywords[i], Qt::CaseInsensitive) == 0)
664 ok = false;
665 i++;
666 }
667 if (ok)
668 {
669 if (toConfigurationSingle::Instance().objectNamesUpper())
670 return name.toUpper();
671 else
672 return name.toLower();
673 }
674 else
675 return QString::fromLatin1("\"") + name + QString::fromLatin1("\"");
676 }
The only real difference is that Oracle flips "toUpper" vs. "toLower" and the 'quoteLowercase' bool. I'm not very good with CPP otherwise I'd try to figure out a patch and submit it. Any ideas?
Best regards,
Sam