sqldb+config: validate maximum batch size config value

Now that the SQL query config values are configurable, we add some
validation to make sure that the user doesnt set a max batch size that
is larger than the limits for sqlite/postgres that have been determined
by the TestSQLSliceQueries test.
This commit is contained in:
Elle Mouton committed 2025-08-13 14:43:31 +02:00
1 parent ee292786b1
commit 185166b8d3
4 files changed
+67 -4

No files matched your search

+10 -4
View File
@@ -281,11 +281,17 @@ func TestSQLSliceQueries(t *testing.T) {
break
}
x *= 10
// If it succeeded, we expect it to be under the maximum that
// we expect for this DB.
if isSQLite {
require.LessOrEqual(t, x, maxSQLiteBatchSize,
"SQLite should not exceed 32766 parameters")
} else {
require.LessOrEqual(t, x, maxPostgresBatchSize,
"Postgres should not exceed 65535 parameters")
}
// Just to make sure that the test doesn't carry on too long,
// we assert that we don't exceed a reasonable limit.
require.LessOrEqual(t, x, 100000)
x *= 10
}
// Now that we have found the limit that the raw query can handle, we