binary type doesn't honor max length
See original GitHub issueThe 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:
object Images : IntIdTable() {
private val image: Column<ByteArray> = binary("image", 10)
fun create(image: ByteArray): Int = transact {
insertAndGetId { it[this.image] = image }.value
}
fun read(id: Int): ByteArray = transact {
select { Images.id eq id }.first()[image]
}
}
Pseudocode for test:
class ImagesTest : FunSpec({
test("size") {
val id = Images.create("wallpaper.jpg") // A file which is too large, say 400,000 bytes.
println("Size: ${Images.read(id).size}") // Prints 400,000.
}
})
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Why does DataAnnotation MaxLength(8192) not work?
it's also a kind of binary data type but its maximum length is about 2GB. it stores all kind of bytes like as...
Read more >54206: Column octet length includes terminating null byte
For variable-length character or binary types, this is the maximum length in bytes. This value does not include the null terminator.
Read more >The Difference between Binary and Integer (And Why You ...
We have a chart in our presentation on the new RPG free format declarations that contains the comment "DO NOT USE!!!" next to...
Read more >Binary data types - Sybase Infocenter
BINARY Binary data of length length bytes. If length is omitted, the default is 1 byte. The maximum size allowed is 255 bytes....
Read more >8, 16, 32, 64 & 128-bit Integer Limits - Video & Lesson Transcript
Learn to define integer data bit size and limits. ... What are Binary Integers (BITs)?; Integer Data Types and Sizes; 8-Bit Integer Limit ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is it expected that
select
queries where value inwhere
clause exceeds column length limit throw the exception as well?As for me throwing exception on
insert
is better than silently truncating the value. But throwing onselect
… I am not so sure.i still got this issue on postgresql.