max_rows rewrites the offset of `LIMIT offset, count` on MySQL/MariaDB/SQLite
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- mariadb, mysql, sql, sqlite, typescript
Direzione di ricerca
Inizia da findTopLevelLimit in src/utils/sql-row-limiter.ts, che secondo l’issue legge il primo numero dopo LIMIT come conteggio delle righe. Controlla i test esistenti del limitatore di righe e aggiungi casi per LIMIT offset, count e LIMIT count OFFSET offset su SQLite e MySQL. Il lavoro è completato quando l’offset viene mantenuto, le righe restituite sono limitate a max_rows e il troncamento viene segnalato quando applicabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
With max_rows set on a tool, a query in the LIMIT offset, count form gets a different page of rows, or more rows than the cap.
[[sources]]
id = "lite"
dsn = "sqlite:///w/t.db"
[[tools]]
name = "execute_sql"
source = "lite"
max_rows = 5
Table t(id) with ids 1..300, on v2.0.0 (main c3b3fc7):
| query | sqlite3 | dbhub |
|---|---|---|
select id from t order by id limit 100, 3 |
101, 102, 103 | 7, 8, 9 |
select id from t order by id limit 3, 10 |
4 .. 13 | 4 .. 13 (10 rows, over max_rows = 5, not marked truncated) |
select id from t order by id limit 3 offset 100 |
101, 102, 103 | 101, 102, 103 |
Same on MySQL 8. No error in either case, so the agent works with the wrong rows.
findTopLevelLimit in src/utils/sql-row-limiter.ts reads the first number after LIMIT as the row count, but in LIMIT a, b that is the offset. The limiter then replaces it with min(a, max_rows + 1) (100 becomes 6), and when a is already under the cap it leaves the query alone, so b is never capped.
#444 had a fix for this and was closed with a request to open an issue first; I didn't find one, so here it is. I can send a PR that caps the second operand of LIMIT a, b and keeps the offset, if that's the direction you want.
- Lingua principale
- TypeScript
- Stelle
- 3.9k
- Fork
- 338
- Merge medio
- 6h 35m
- PR unite (30g)
- 37
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bytebase/dbhub
-
👉👉👉 Please share your use case to shape DBHub roadmapForse di nuovo libera @tianzhou l’ha presa 357 giorni fa e non c’è nessuna pull request aperta. Aperta
bytebase/dbhub#146 · 27 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bytebase/dbhub
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
redhat-developer/rhdh-plugin-export-overlays#4794 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
area: plugins documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
CatVinci-Studio/Textus#727 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno