Skip to content
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

Can't read text column, if it exceeds 255 chars. #1029

Closed
neetkee opened this issue Aug 31, 2020 · 1 comment
Closed

Can't read text column, if it exceeds 255 chars. #1029

neetkee opened this issue Aug 31, 2020 · 1 comment
Assignees
Labels

Comments

@neetkee
Copy link
Contributor

neetkee commented Aug 31, 2020

Starting with 0.26.2 it's impossible to read text column, if its length exceeds 255 symbols. However, it's possible to write such value.

DB: Postgresql

Example data:

create table test
(
    id      uuid default gen_random_uuid() not null primary key,
    content text                           not null
);
object TestTable: UUIDTable(name = "test") {
    val content = text("content")
}

class TestEntity(id: EntityID<UUID>): UUIDEntity(id) {
    companion object: UUIDEntityClass<TestEntity>(TestTable)
    var content by TestTable.content
}
@Test
fun `check exposed text column`() {
    val content = "a".repeat(256)
    transaction {
        TestEntity.new {
            this.content = content
        }
    }
    transaction {
        TestEntity.find { TestTable.content.eq(content) }.first()
    }
}
Value 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' can't be stored to database column because exceeds length (255)
java.lang.IllegalArgumentException: Value 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' can't be stored to database column because exceeds length (255)
	at org.jetbrains.exposed.sql.VarCharColumnType.notNullValueToDB(ColumnType.kt:541)
	at org.jetbrains.exposed.sql.IColumnType$DefaultImpls.valueToDB(ColumnType.kt:37)
	at org.jetbrains.exposed.sql.ColumnType.valueToDB(ColumnType.kt:71)
	at org.jetbrains.exposed.sql.statements.api.PreparedStatementApi$DefaultImpls.fillParameters(PreparedStatementApi.kt:13)
	at org.jetbrains.exposed.sql.statements.jdbc.JdbcPreparedStatementImpl.fillParameters(JdbcPreparedStatementImpl.kt:9)
	at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:53)
	at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:129)
	at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:115)
	at org.jetbrains.exposed.sql.Query.iterator(Query.kt:214)
	at org.jetbrains.exposed.sql.IterableExKt$mapLazy$1.iterator(IterableEx.kt:129)
	at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:198)
@Tapac Tapac self-assigned this Aug 31, 2020
@Tapac Tapac added the bug label Aug 31, 2020
@Tapac Tapac closed this as completed Aug 31, 2020
@TheReprator
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants