k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.63k stars 235 forks source link

Question: Using LIMIT 0 in PostgreSQL #237

Closed TheodoreCAshmore closed 11 months ago

TheodoreCAshmore commented 11 months ago

Hi, Sorry for posting a question within Issues, but I guess that's the only place I can ask? Anyway, I have been looking deep into Kine (using PostgreSQL) and I've noticed that sometimes queries are launched with a LIMIT 0. According to my SQL understanding, such query shouldn't return any row. However, I've seen that in some of such queries there's actually a return value. It seems that happens mainly when calling ListCurrent from within the method List in sql.go. Most times nothing is returned, sometimes it's just one Event (after using RowsToEvents) and other times is more than that. I've been looking high and low, but I haven't found an answer anywhere. Is there anyone who could shed some light into that? How can I get results when I'm using a query with LIMIT 0?

Thank you so much!

TheodoreCAshmore commented 11 months ago

Nevermind, my bad. I see now that limit = 0 is used to specify that the query should be unlimited. Sorry.