diff --git a/go/go.mod b/go/go.mod index 6455d03c6d..95739454b8 100644 --- a/go/go.mod +++ b/go/go.mod @@ -57,7 +57,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 github.com/creasty/defaults v1.6.0 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.18.2-0.20240917161933-32eff493e467 + github.com/dolthub/go-mysql-server v0.18.2-0.20240918043246-e3846f5468f5 github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 github.com/dolthub/swiss v0.1.0 github.com/goccy/go-json v0.10.2 diff --git a/go/go.sum b/go/go.sum index bbd462a4fc..2ae9bdb099 100644 --- a/go/go.sum +++ b/go/go.sum @@ -183,8 +183,8 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U= github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0= github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662 h1:aC17hZD6iwzBwwfO5M+3oBT5E5gGRiQPdn+vzpDXqIA= github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= -github.com/dolthub/go-mysql-server v0.18.2-0.20240917161933-32eff493e467 h1:Q1VtNuqdXiCDVdCpuOrqxHCAQaHtkHe8HMBejNQz5gc= -github.com/dolthub/go-mysql-server v0.18.2-0.20240917161933-32eff493e467/go.mod h1:m88EMm9OthVVa6qIhbpnRDpj/eYUXuNpvY/+0YWKVwc= +github.com/dolthub/go-mysql-server v0.18.2-0.20240918043246-e3846f5468f5 h1:m12ohMzoZUQExnXqWeTYziQiSwwtzjoEFBSKzBVHin8= +github.com/dolthub/go-mysql-server v0.18.2-0.20240918043246-e3846f5468f5/go.mod h1:m88EMm9OthVVa6qIhbpnRDpj/eYUXuNpvY/+0YWKVwc= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q= github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE= diff --git a/go/libraries/doltcore/sqle/dtables/unscoped_diff_table.go b/go/libraries/doltcore/sqle/dtables/unscoped_diff_table.go index d6814c0356..920019913c 100644 --- a/go/libraries/doltcore/sqle/dtables/unscoped_diff_table.go +++ b/go/libraries/doltcore/sqle/dtables/unscoped_diff_table.go @@ -141,7 +141,7 @@ func (dt *UnscopedDiffTable) PartitionRows(ctx *sql.Context, partition sql.Parti // GetIndexes implements sql.IndexAddressable func (dt *UnscopedDiffTable) GetIndexes(ctx *sql.Context) ([]sql.Index, error) { - return index.DoltCommitIndexes(dt.dbName, dt.Name(), dt.ddb, true) + return index.DoltCommitIndexes(dt.dbName, dt.Name(), dt.ddb, false) } // IndexedAccess implements sql.IndexAddressable diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_queries_diff.go b/go/libraries/doltcore/sqle/enginetest/dolt_queries_diff.go index a2a7f1c9bf..48bbc97297 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_queries_diff.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_queries_diff.go @@ -671,6 +671,24 @@ var DiffSystemTableScriptTests = []queries.ScriptTest{ }, }, }, + { + Name: "duplicate commit_hash", + SetUpScript: []string{ + "create table t1 (x int primary key)", + "create table t2 (x int primary key)", + "call dolt_add('.');", + "call dolt_commit_hash_out(@commit1, '-Am', 'commit1');", + }, + Assertions: []queries.ScriptTestAssertion{ + { + Query: "select table_name from dolt_diff where commit_hash = @commit1", + Expected: []sql.Row{ + {"t1"}, + {"t2"}, + }, + }, + }, + }, } var Dolt1DiffSystemTableScripts = []queries.ScriptTest{ diff --git a/integration-tests/bats/diff.bats b/integration-tests/bats/diff.bats index e1ae4f8468..a8ca971ade 100644 --- a/integration-tests/bats/diff.bats +++ b/integration-tests/bats/diff.bats @@ -1954,3 +1954,15 @@ SQL [[ $output =~ "diff --dolt a/test b/test" ]] || false [[ $output =~ "deleted table" ]] || false } + +@test "diff: duplicate commit_hash in diff" { + dolt reset --hard + dolt sql -q "create table t1 (i int primary key);" + dolt sql -q "create table t2 (j int primary key);" + dolt add . + dolt commit -m "commit 1" + run dolt sql -q "select table_name from dolt_diff where commit_hash = hashof('HEAD')" + [ $status -eq 0 ] + [[ "$output" =~ "t1" ]] || false + [[ "$output" =~ "t2" ]] || false +}