-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
binary type doesn't honor max length #993
Comments
What Exposed version and database do you use? |
Postgres 12.3 Kotlin 1.3.72 + JDK 8 + JVM 13 Gradle 6.5.1 dependencies: val exposedVersion = "0.26.1"
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion") |
There is no client-side validation of length at the moment and PostgreSQL's |
Client-side length validation for BinaryColumnType
Ohh. Thanks. To me, it looked like the DB would provide validation since the docs don't explicitly state which DBs validate lengths by themselves, and the limitless
Since the limited |
Is it expected that As for me throwing exception on
|
Interesting that in case of object T : Table("testlength") {
val id = varchar("id", 5)
override val primaryKey = PrimaryKey(id)
}
@Test
fun shouldNotThrowWhenBelow256() {
transaction {
val s = "0".repeat(255) // note the column is VARCHAR(5)
T.select { T.id eq s }.count()
}
}
@Test
fun shouldNotThrowWhenAbove255() {
transaction {
val s = "0".repeat(300)
T.select { T.id eq s }.count()
}
} MySQL (tested with mysql command line client and server v8.0.19) does not throw a warning and does not truncate the argument before performing the comparison.
|
The
binary
fixed-length type doesn't seem to honor the provided length: no error is thrown, no warning is logged, and the image isn't even silently trimmed to the specified maximum number of bytes.Pseudocode for table:
Pseudocode for test:
The text was updated successfully, but these errors were encountered: