@@ -1199,66 +1199,6 @@ jobs:
11991199 open(path, 'w').write(src)
12001200 print('patched hex-literal alias force under Turso')
12011201
1202- # 18. Rewrite AUTO_INCREMENT subquery in information_schema.tables
1203- # from a correlated scalar subquery (which Turso evaluates
1204- # incorrectly for some rows) to a plain SELECT with a correlated
1205- # SELECT aggregated via MAX so the result is stable per outer
1206- # row. Both testInformationSchemaTablesFilterByAutoIncrement
1207- # and testCreateTableSetAutoIncrement rely on this returning
1208- # NULL for tables without auto_increment columns.
1209- src = open(path).read()
1210- old = (
1211- "\t\t\t\t\t$auto_increment_subquery = sprintf(\n"
1212- "\t\t\t\t\t\t\"(\n"
1213- "\t\t\t\t\t\t\tSELECT COALESCE(s.seq + 1, 1)\n"
1214- "\t\t\t\t\t\t\tFROM %s AS c\n"
1215- "\t\t\t\t\t\t\t%s\n"
1216- "\t\t\t\t\t\t\tWHERE c.extra = 'auto_increment'\n"
1217- "\t\t\t\t\t\t\tAND c.table_schema = %s.table_schema\n"
1218- "\t\t\t\t\t\t\tAND c.table_name = %s.table_name\n"
1219- "\t\t\t\t\t\t)\",\n"
1220- )
1221- new = (
1222- "\t\t\t\t\t$auto_increment_subquery = sprintf(\n"
1223- "\t\t\t\t\t\t\"(\n"
1224- "\t\t\t\t\t\t\tSELECT MAX(COALESCE(s.seq + 1, 1))\n"
1225- "\t\t\t\t\t\t\tFROM %s AS c\n"
1226- "\t\t\t\t\t\t\t%s\n"
1227- "\t\t\t\t\t\t\tWHERE c.extra = 'auto_increment'\n"
1228- "\t\t\t\t\t\t\tAND c.table_schema = %s.table_schema\n"
1229- "\t\t\t\t\t\t\tAND c.table_name = %s.table_name\n"
1230- "\t\t\t\t\t\t)\",\n"
1231- )
1232- assert old in src, 'AUTO_INCREMENT subquery (tables view) not found'
1233- src = src.replace(old, new, 1)
1234- # Also the SHOW TABLE STATUS variant at line 3018.
1235- old2 = (
1236- "\t\t$auto_increment_subquery = sprintf(\n"
1237- "\t\t\t\"(\n"
1238- "\t\t\t\tSELECT COALESCE(s.seq + 1, 1)\n"
1239- "\t\t\t\tFROM %s AS c\n"
1240- "\t\t\t\t%s\n"
1241- "\t\t\t\tWHERE c.extra = 'auto_increment'\n"
1242- "\t\t\t\tAND c.table_schema = t.table_schema\n"
1243- "\t\t\t\tAND c.table_name = t.table_name\n"
1244- "\t\t\t)\",\n"
1245- )
1246- new2 = (
1247- "\t\t$auto_increment_subquery = sprintf(\n"
1248- "\t\t\t\"(\n"
1249- "\t\t\t\tSELECT MAX(COALESCE(s.seq + 1, 1))\n"
1250- "\t\t\t\tFROM %s AS c\n"
1251- "\t\t\t\t%s\n"
1252- "\t\t\t\tWHERE c.extra = 'auto_increment'\n"
1253- "\t\t\t\tAND c.table_schema = t.table_schema\n"
1254- "\t\t\t\tAND c.table_name = t.table_name\n"
1255- "\t\t\t)\",\n"
1256- )
1257- assert old2 in src, 'AUTO_INCREMENT subquery (show status) not found'
1258- src = src.replace(old2, new2, 1)
1259- open(path, 'w').write(src)
1260- print('patched AUTO_INCREMENT correlated subquery with MAX aggregate')
1261-
12621202 # 10. CHECK TABLE on a missing table on real SQLite raises from
12631203 # `PRAGMA integrity_check(<tbl>)`; on Turso the PRAGMA is a
12641204 # no-op for unknown tables, so testCheckTable sees status=OK
0 commit comments