nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: AlecStrong/sql-psi
Pull request #370 (2022-04-08 01:10:50)

Add exclusive as an acceptable pragma value
Closes https://github.com/AlecStrong/sql-psi/issues/274


Patch:
diff --git a/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf b/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf
index b138938..8017324 100644
--- a/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf
+++ b/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf
@@ -310,7 +310,8 @@ pragma_stmt ::= PRAGMA [ database_name '.' ] pragma_name [ '=' pragma_value | '(
 }
 pragma_value ::= ( signed_number
                  | identifier
-                 | string_literal )
+                 | string_literal
+                 | EXCLUSIVE )
 reindex_stmt ::= REINDEX [ collation_name | [ database_name '.' ] ( table_name | index_name ) ] {
   pin = 1
 }


Test patch:
diff --git a/test-fixtures/src/main/resources/fixtures/pragmas/Test.s b/test-fixtures/src/main/resources/fixtures/pragmas/Test.s
new file mode 100644
index 0000000..9ffabd9
--- /dev/null
+++ b/test-fixtures/src/main/resources/fixtures/pragmas/Test.s
@@ -0,0 +1,1 @@
+PRAGMA locking_mode = EXCLUSIVE;
\ No newline at end of file
Repository: AlecStrong/sql-psi
Pull request #392 (2022-05-06 17:38:34)

Treat generated columns as having a default value
Closes https://github.com/cashapp/sqldelight/issues/3167


Patch:
diff --git a/core/src/main/kotlin/com/alecstrong/sql/psi/core/psi/mixins/ColumnDefMixin.kt b/core/src/main/kotlin/com/alecstrong/sql/psi/core/psi/mixins/ColumnDefMixin.kt
index a966aaa..2891e05 100644
--- a/core/src/main/kotlin/com/alecstrong/sql/psi/core/psi/mixins/ColumnDefMixin.kt
+++ b/core/src/main/kotlin/com/alecstrong/sql/psi/core/psi/mixins/ColumnDefMixin.kt
@@ -9,6 +9,7 @@ abstract class ColumnDefMixin(node: ASTNode) : SqlCompositeElementImpl(node), Sq
 
   open fun hasDefaultValue(): Boolean {
     return columnConstraintList.any { it.defaultConstraint != null } ||
-      columnConstraintList.none { it.node.findChildByType(SqlTypes.NOT) != null }
+      columnConstraintList.none { it.node.findChildByType(SqlTypes.NOT) != null } ||
+      columnConstraintList.any { it.generatedClause != null }
   }
 }


Test patch:
diff --git a/test-fixtures/src/main/resources/fixtures/generated-default/Test.s b/test-fixtures/src/main/resources/fixtures/generated-default/Test.s
new file mode 100644
index 0000000..e5e568d
--- /dev/null
+++ b/test-fixtures/src/main/resources/fixtures/generated-default/Test.s
@@ -0,0 +1,6 @@
+CREATE TABLE objects (
+    id TEXT GENERATED ALWAYS AS (2) UNIQUE NOT NULL,
+    object TEXT NOT NULL
+);
+
+INSERT INTO objects(object) VALUES (?);
\ No newline at end of file
Repository: AlecStrong/sql-psi
Pull request #420 (2022-08-15 13:39:15)

Add SELECT INTO
Related to https://github.com/cashapp/sqldelight/issues/3440

Do you want it? It is sql, but the embedded dialect which I need at https://github.com/hfhbd/sqldelight-db2-dialect. 

Alternative I have to overwrite the `select_stmt` in the db2 dialect but this is complex with internal classes and logic eg SelectMixin is internal and uses internal extension functions

AlecStrong: is this part of ANSI sql? where was that checklist that got posted in one of these PRs
hfhbd: Yeah, it is in the chapter 10 of the ansi standard: https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC90751020162017

Patch:
diff --git a/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf b/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf
index 5efac75..e2d3d36 100644
--- a/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf
+++ b/core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf
@@ -330,7 +330,7 @@ compound_select_stmt ::= [ with_clause ] select_stmt  ( compound_operator select
   ]
 }
 limiting_term ::= expr
-select_stmt ::= SELECT [ DISTINCT | ALL ] result_column ( COMMA result_column ) * [ FROM join_clause ] [ WHERE expr ] [ GROUP BY expr ( COMMA expr ) * [ HAVING expr ] ] | VALUES values_expression ( COMMA values_expression ) * {
+select_stmt ::= SELECT [ DISTINCT | ALL ] result_column ( COMMA result_column ) * [INTO bind_expr ( COMMA bind_expr ) * ] [ FROM join_clause ] [ WHERE expr ] [ GROUP BY expr ( COMMA expr ) * [ HAVING expr ] ] | VALUES values_expression ( COMMA values_expression ) * {
   mixin = "com.alecstrong.sql.psi.core.psi.mixins.SelectStmtMixin"
   implements = [
     "com.alecstrong.sql.psi.core.psi.QueryElement";


Test patch:
diff --git a/test-fixtures/src/main/resources/fixtures/cast/Test.s b/test-fixtures/src/main/resources/fixtures/cast/Test.s
new file mode 100644
index 0000000..5f4170b
--- /dev/null
+++ b/test-fixtures/src/main/resources/fixtures/cast/Test.s
@@ -0,0 +1,7 @@
+CREATE TABLE test (
+  _id INTEGER NOT NULL
+);
+
+SELECT CAST(_id AS INTEGER)
+FROM test
+WHERE CAST(CAST(_id AS INTEGER) AS INTEGER);
diff --git a/test-fixtures/src/main/resources/fixtures/generated-default/Test.s b/test-fixtures/src/main/resources/fixtures/generated-default/Test.s
index e5e568d..03d711d 100644
--- a/test-fixtures/src/main/resources/fixtures/generated-default/Test.s
+++ b/test-fixtures/src/main/resources/fixtures/generated-default/Test.s
@@ -3,4 +3,4 @@ CREATE TABLE objects (
     object TEXT NOT NULL
 );
 
-INSERT INTO objects(object) VALUES (?);
\ No newline at end of file
+INSERT INTO objects(object) VALUES (?);
diff --git a/test-fixtures/src/main/resources/fixtures/select-into/Test.s b/test-fixtures/src/main/resources/fixtures/select-into/Test.s
new file mode 100644
index 0000000..339342e
--- /dev/null
+++ b/test-fixtures/src/main/resources/fixtures/select-into/Test.s
@@ -0,0 +1,5 @@
+CREATE TABLE test (
+  _id INTEGER NOT NULL
+);
+
+SELECT _id, _id INTO ?, ? FROM test;