Skip to content

Commit

Permalink
Merge pull request #901 from dolthub/taylor/read-dtables
Browse files Browse the repository at this point in the history
More system table updates, add and unskip some tests
  • Loading branch information
tbantle22 authored Oct 30, 2024
2 parents efb36fa + e6d6a19 commit 6842f4a
Show file tree
Hide file tree
Showing 6 changed files with 1,061 additions and 43 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/cockroachdb/apd/v2 v2.0.3-0.20200518165714-d020e156310a
github.com/cockroachdb/errors v1.7.5
github.com/dolthub/dolt/go v0.40.5-0.20241028195925-746ebc613846
github.com/dolthub/dolt/go v0.40.5-0.20241030222313-1035f4fe0f65
github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20240827111219-e4bb9ca3442d
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662
github.com/dolthub/go-mysql-server v0.18.2-0.20241028220705-fc9e96ed4c1d
github.com/dolthub/go-mysql-server v0.18.2-0.20241029221022-84d576aadba3
github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216
github.com/dolthub/vitess v0.0.0-20241028204000-267861bc75a0
github.com/fatih/color v1.13.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dolthub/dolt/go v0.40.5-0.20241028195925-746ebc613846 h1:IYbgv29ClfGVj/vM4qxQpZJQnw9XdrW8UZxNaVYJjKc=
github.com/dolthub/dolt/go v0.40.5-0.20241028195925-746ebc613846/go.mod h1:sZ612KergPWZQkkCL5uVi6BV15YH08HlBXOyRzEccg8=
github.com/dolthub/dolt/go v0.40.5-0.20241030222313-1035f4fe0f65 h1:M+mytO/63y6/1/izuKKn6WQ+bvHSARHOq+3m4nHYEsw=
github.com/dolthub/dolt/go v0.40.5-0.20241030222313-1035f4fe0f65/go.mod h1:i8wcX6lhfFfRt5SR9YzL6l4rHMguTOaz+uvQBTjoykE=
github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20240827111219-e4bb9ca3442d h1:RZkQeYOrDrOWzCxaP2ttkvg4E2TM9n8lnEsIBLKjqkM=
github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20240827111219-e4bb9ca3442d/go.mod h1:L5RDYZbC9BBWmoU2+TjTekeqqhFXX5EqH9ln00O0stY=
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww=
Expand All @@ -224,8 +224,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.20241028220705-fc9e96ed4c1d h1:FLs7/W5OmRnp/UPRw5PEa+PrcvtVk5ZV+C9RCQ78CnE=
github.com/dolthub/go-mysql-server v0.18.2-0.20241028220705-fc9e96ed4c1d/go.mod h1:jlzVUA+tsjDw6YKbhRsCLHT3OVO6nn4BWrUanECTo3s=
github.com/dolthub/go-mysql-server v0.18.2-0.20241029221022-84d576aadba3 h1:+8/lCQN28l+a14+b/RX3DfkWU5eZMKTqIt8ATKWEQ7c=
github.com/dolthub/go-mysql-server v0.18.2-0.20241029221022-84d576aadba3/go.mod h1:jlzVUA+tsjDw6YKbhRsCLHT3OVO6nn4BWrUanECTo3s=
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=
Expand Down
67 changes: 65 additions & 2 deletions server/tables/dtables/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,92 @@ import (

// Init handles initialization of all Postgres-specific and Doltgres-specific Dolt system tables.
func Init() {
dtables.GetDocsSchema = getDocsSchema
doltdb.GetDocTableName = getDocTableName
// Table names
doltdb.GetBranchesTableName = getBranchesTableName
doltdb.GetDocTableName = getDocTableName
doltdb.GetColumnDiffTableName = getColumnDiffTableName
doltdb.GetCommitAncestorsTableName = getCommitAncestorsTableName
doltdb.GetCommitsTableName = getCommitsTableName
doltdb.GetDiffTableName = getDiffTableName
doltdb.GetLogTableName = getLogTableName
doltdb.GetMergeStatusTableName = getMergeStatusTableName
doltdb.GetRemoteBranchesTableName = getRemoteBranchesTableName
doltdb.GetRemotesTableName = getRemotesTableName
doltdb.GetSchemaConflictsTableName = getSchemaConflictsTableName
doltdb.GetStatusTableName = getStatusTableName
doltdb.GetTableOfTablesInConflictName = getTableOfTablesInConflictName
doltdb.GetTableOfTablesWithViolationsName = getTableOfTablesWithViolationsName
doltdb.GetTagsTableName = getTagsTableName

// Schemas
dtables.GetDocsSchema = getDocsSchema
}

// getBranchesTableName returns the name of the branches table.
func getBranchesTableName() string {
return "branches"
}

// getColumnDiffTableName returns the name of the column diff table.
func getColumnDiffTableName() string {
return "column_diff"
}

// getCommitAncestorsTableName returns the name of the commit ancestors table.
func getCommitAncestorsTableName() string {
return "commit_ancestors"
}

// getCommitsTableName returns the name of the commits table.
func getCommitsTableName() string {
return "commits"
}

// getDiffTableName returns the name of the diff table.
func getDiffTableName() string {
return "diff"
}

// getLogTableName returns the name of the branches table.
func getLogTableName() string {
return "log"
}

// getMergeStatusTableName returns the name of the merge status table.
func getMergeStatusTableName() string {
return "merge_status"
}

// getRemoteBranchesTableName returns the name of the remote branches table.
func getRemoteBranchesTableName() string {
return "remote_branches"
}

// getRemotesTableName returns the name of the remotes table.
func getRemotesTableName() string {
return "remotes"
}

// getSchemaConflictsTableName returns the name of the schema conflicts table.
func getSchemaConflictsTableName() string {
return "schema_conflicts"
}

// getStatusTableName returns the name of the status table.
func getStatusTableName() string {
return "status"
}

// getTableOfTablesInConflictName returns the name of the conflicts table.
func getTableOfTablesInConflictName() string {
return "conflicts"
}

// getTableOfTablesWithViolationsName returns the name of the constraint violations table.
func getTableOfTablesWithViolationsName() string {
return "constraint_violations"
}

// getTagsTableName returns the name of the tags table.
func getTagsTableName() string {
return "tags"
Expand Down
8 changes: 4 additions & 4 deletions testing/go/dolt_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func TestDoltFunctions(t *testing.T) {
},
},
{
Name: "smoke test select dolt_diff functions and tables",
Name: "smoke test select dolt diff functions and tables",
SetUpScript: []string{
"CREATE TABLE t1 (pk int primary key);",
"INSERT INTO t1 VALUES (1);",
Expand Down Expand Up @@ -320,7 +320,7 @@ func TestDoltFunctions(t *testing.T) {
},
},
{
Query: "SELECT * FROM dolt_diff",
Query: "SELECT * FROM dolt.diff",
Expected: []sql.Row{
{"WORKING", "public.t1", nil, nil, nil, nil, 1, 1},
},
Expand Down Expand Up @@ -361,7 +361,7 @@ func TestDoltFunctions(t *testing.T) {
},
},
{
Name: "smoke test select dolt_diff functions and tables for multiple schemas",
Name: "smoke test select dolt diff functions and tables for multiple schemas",
SetUpScript: []string{
"CREATE TABLE t1 (pk int primary key);",
"INSERT INTO t1 VALUES (1);",
Expand Down Expand Up @@ -436,7 +436,7 @@ func TestDoltFunctions(t *testing.T) {
},
},
{
Query: "SELECT * FROM dolt_diff",
Query: "SELECT * FROM dolt.diff",
Expected: []sql.Row{
{"WORKING", "public.t1", nil, nil, nil, nil, 1, 1},
{"WORKING", "testschema.t2", nil, nil, nil, nil, 1, 1},
Expand Down
Loading

0 comments on commit 6842f4a

Please sign in to comment.