mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Have "sqldiff --rbu" ignore rows with NULL values in primary key fields. RBU can't handle such rows and the documentation already says sqldiff ignores them. Because the code now uses "=" instead of "IS" to filter on primary key columns, diffs on virtual tables are faster now too.
FossilOrigin-Name: f4ba894a86aa195bcbe2fa69e91cd870ec3fb577
This commit is contained in:
@ -1179,8 +1179,9 @@ static void getRbudiffQuery(
|
||||
strPrintf(pSql, " FROM aux.%Q AS n WHERE NOT EXISTS (\n", zTab);
|
||||
strPrintf(pSql, " SELECT 1 FROM ", zTab);
|
||||
strPrintf(pSql, " main.%Q AS o WHERE ", zTab);
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q IS o.%Q)", azCol, nPK);
|
||||
strPrintf(pSql, "\n)");
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q = o.%Q)", azCol, nPK);
|
||||
strPrintf(pSql, "\n) AND ");
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q IS NOT NULL)", azCol, nPK);
|
||||
|
||||
/* Deleted rows: */
|
||||
strPrintf(pSql, "\nUNION ALL\nSELECT ");
|
||||
@ -1194,8 +1195,9 @@ static void getRbudiffQuery(
|
||||
strPrintf(pSql, " FROM main.%Q AS n WHERE NOT EXISTS (\n", zTab);
|
||||
strPrintf(pSql, " SELECT 1 FROM ", zTab);
|
||||
strPrintf(pSql, " aux.%Q AS o WHERE ", zTab);
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q IS o.%Q)", azCol, nPK);
|
||||
strPrintf(pSql, "\n) ");
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q = o.%Q)", azCol, nPK);
|
||||
strPrintf(pSql, "\n) AND ");
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q IS NOT NULL)", azCol, nPK);
|
||||
|
||||
/* Updated rows. If all table columns are part of the primary key, there
|
||||
** can be no updates. In this case this part of the compound SELECT can
|
||||
@ -1226,7 +1228,7 @@ static void getRbudiffQuery(
|
||||
);
|
||||
|
||||
strPrintf(pSql, "\nFROM main.%Q AS o, aux.%Q AS n\nWHERE ", zTab, zTab);
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q IS o.%Q)", azCol, nPK);
|
||||
strPrintfArray(pSql, " AND ", "(n.%Q = o.%Q)", azCol, nPK);
|
||||
strPrintf(pSql, " AND ota_control LIKE '%%x%%'");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user