psql: Add expected failures where the table name is case sensitive

Currently there is a bug in Qt regarding the PostgreSQL driver as it
does not correctly escape the table names when constructing queries
internally. Therefore, these tests are marked as expected failures until
the bug itself is fixed in Qt.

Change-Id: I74dadc187f8a08509128dfea27be99787e57ea51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Andy Shaw 2018-01-17 09:02:29 +01:00
parent 8dbd245979
commit 8635ad1b59
3 changed files with 16 additions and 2 deletions

View File

@ -2711,10 +2711,9 @@ void tst_QSqlQuery::lastInsertId()
QSqlQuery q( db );
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
// PostgreSQL >= 8.1 relies on lastval() which does not work if a value is
// manually inserted to the serial field, so we create a table specifically
if (dbType == QSqlDriver::PostgreSQL) {
if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) {
const auto tst_lastInsertId = qTableName("tst_lastInsertId", __FILE__, db);
tst_Databases::safeDropTable(db, tst_lastInsertId);
QVERIFY_SQL(q, exec(QStringLiteral("create table ") + tst_lastInsertId +
@ -3681,6 +3680,8 @@ void tst_QSqlQuery::QTBUG_5251()
QSqlTableModel timetestModel(0,db);
timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit);
timetestModel.setTable(timetest);
if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(timetestModel, select());
QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("01:02:03.666"));

View File

@ -1547,6 +1547,8 @@ void tst_QSqlRelationalTableModel::relationOnFirstColumn()
//modify the model data
QVERIFY_SQL(model, setData(model.index(0, 0), 40));
if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submit());
QVERIFY_SQL(model, setData(model.index(1, 0), 50));
QVERIFY_SQL(model, submit());

View File

@ -360,6 +360,8 @@ void tst_QSqlTableModel::selectRow()
q.exec("UPDATE " + tbl + " SET a = 'Qt' WHERE id = 1");
QCOMPARE(model.data(idx).toString(), QString("b"));
model.selectRow(1);
if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QCOMPARE(model.data(idx).toString(), QString("Qt"));
// Check if selectRow() refreshes a changed row.
@ -416,6 +418,8 @@ void tst_QSqlTableModel::selectRowOverride()
// both rows should have changed
QCOMPARE(model.data(idx).toString(), QString("Qt"));
idx = model.index(2, 1);
if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QCOMPARE(model.data(idx).toString(), QString("Qt"));
q.exec("DELETE FROM " + tbl);
@ -826,6 +830,9 @@ void tst_QSqlTableModel::insertRowFailure()
values.setGenerated(1, true);
// populate 1 row
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL && submitpolicy != QSqlTableModel::OnManualSubmit)
QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, insertRecord(0, values));
QVERIFY_SQL(model, submitAll());
QVERIFY_SQL(model, select());
@ -869,6 +876,8 @@ void tst_QSqlTableModel::insertRowFailure()
// restore empty table
model.revertAll();
QVERIFY_SQL(model, removeRow(0));
if (dbType == QSqlDriver::PostgreSQL)
QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submitAll());
QVERIFY_SQL(model, select());
QCOMPARE(model.rowCount(), 0);
@ -1977,6 +1986,8 @@ void tst_QSqlTableModel::tableModifyWithBlank()
//Should be equivalent to QSqlQuery INSERT INTO... command)
QVERIFY_SQL(model, insertRow(0));
QVERIFY_SQL(model, setData(model.index(0,0),timeString));
if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submitAll());
//set a filter on the table so the only record we get is the one we just made