diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt index 003592b164..214121170f 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt @@ -1115,7 +1115,9 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { private fun Column.cloneWithAutoInc(idSeqName: String?): Column = when (columnType) { is AutoIncColumnType -> this is ColumnType -> { - this.withColumnType(AutoIncColumnType(columnType, idSeqName, "${tableName}_${name}_seq")) + this.withColumnType( + AutoIncColumnType(columnType, idSeqName, "${tableName?.replace("\"", "")}_${name}_seq") + ) } else -> error("Unsupported column type for auto-increment $columnType") diff --git a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateTableTests.kt b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateTableTests.kt index 93bf9e2341..a5de737aca 100644 --- a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateTableTests.kt +++ b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateTableTests.kt @@ -335,16 +335,14 @@ class CreateTableTests : DatabaseTestsBase() { onDelete = ReferenceOption.NO_ACTION, ) } - withTables(excludeSettings = listOf(TestDB.H2_ORACLE, TestDB.ORACLE), parent, child) { - val expected = listOf( - "CREATE TABLE " + addIfNotExistsIfSupported() + "${this.identity(child)} (" + - "${child.columns.joinToString { it.descriptionDdl(false) }}," + - " CONSTRAINT ${"fk_Child_parent_id__id".inProperCase()}" + - " FOREIGN KEY (${this.identity(child.parentId)})" + - " REFERENCES ${this.identity(parent)}(${this.identity(parent.id)})" + - ")" - ) - assertEqualCollections(child.ddl, expected) + withTables(parent, child) { + val expected = "CREATE TABLE " + addIfNotExistsIfSupported() + "${this.identity(child)} (" + + "${child.columns.joinToString { it.descriptionDdl(false) }}," + + " CONSTRAINT ${"fk_Child_parent_id__id".inProperCase()}" + + " FOREIGN KEY (${this.identity(child.parentId)})" + + " REFERENCES ${this.identity(parent)}(${this.identity(parent.id)})" + + ")" + assertEquals(child.ddl.last(), expected) } }