PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: slick/slick (scala)

Issue:
Oracle field default string values not escaped correctly in createIfNotExists
If a table has been defined with String field(s) with default values, then createIfNotExists generates invalid DDL for Oracle, because the string constant for the default value is not escaped correctly for Oracle.

Pull request:
Fixes #2151

Patch:
diff --git a/slick/src/main/scala/slick/jdbc/OracleProfile.scala b/slick/src/main/scala/slick/jdbc/OracleProfile.scala
index 52f60592f4..40ce25b610 100644
--- a/slick/src/main/scala/slick/jdbc/OracleProfile.scala
+++ b/slick/src/main/scala/slick/jdbc/OracleProfile.scala
@@ -171,7 +171,7 @@ trait OracleProfile extends JdbcProfile {
 BEGIN
 
 """+ ((createPhase1 ++ createPhase2).map{s =>
-      "execute immediate '"+ s.replaceAll("'", """\\'""") + " ';"
+      "execute immediate '"+ s.replaceAll("'", "''") + " ';"
   }.mkString("\n")) +"""
 EXCEPTION
     WHEN OTHERS THEN


Test patch:
diff --git a/slick-testkit/src/test/scala/slick/test/lifted/OracleDDLTest.scala b/slick-testkit/src/test/scala/slick/test/lifted/OracleDDLTest.scala
new file mode 100644
index 0000000000..ec38a36b9f
--- /dev/null
+++ b/slick-testkit/src/test/scala/slick/test/lifted/OracleDDLTest.scala
@@ -0,0 +1,23 @@
+package slick.test.lifted
+
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class OracleDDLTest {
+
+  import slick.jdbc.OracleProfile.api._
+
+  @Test
+  def testDefaultEscaped: Unit = {
+    class T(tag: Tag) extends Table[String](tag, Some("myschema"), "mytable") {
+      def id = column[String]("id", O.PrimaryKey, O.Default("N"))
+
+      def * = id
+    }
+    val ts = TableQuery[T]
+    val tCreateIfNotExistsStatements = ts.schema.createIfNotExistsStatements.toList
+    assertTrue("DDL (createIfNotExists) must contain SQL statement(s)", tCreateIfNotExistsStatements.nonEmpty)
+    assertTrue("Default must be escaped", tCreateIfNotExistsStatements.exists(_.contains("''N''")))
+  }
+
+}