From b90da17d10c58ffdc1168d1319a6e9ab665afd47 Mon Sep 17 00:00:00 2001 From: James Cor Date: Wed, 6 Nov 2024 16:56:11 -0800 Subject: [PATCH 01/16] implement single table inherits --- server/ast/create_table.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/ast/create_table.go b/server/ast/create_table.go index ba2c512a8b..f5ac52cfbc 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -77,6 +77,24 @@ func nodeCreateTable(node *tree.CreateTable) (*vitess.DDL, error) { if err = assignTableDefs(node.Defs, ddl); err != nil { return nil, err } + for i, table := range node.Inherits { + // TODO: also check for schemas along with inherits + if i > 0 { + return nil, fmt.Errorf("Multiple INHERITS is not yet supported") + } + if len(node.Defs) > 0 { + return nil, fmt.Errorf("INHERITS with TableDefs is not yet supported") + } + likeTable, err := nodeTableName(&table) + if err != nil { + return nil, err + } + optLike := &vitess.OptLike{ + LikeTable: likeTable, + } + ddl.OptLike = optLike + } + if node.PartitionBy != nil { switch node.PartitionBy.Type { case tree.PartitionByList: From 44b3bb3e076c27944675cfc58922a762d4e3d028 Mon Sep 17 00:00:00 2001 From: James Cor Date: Thu, 7 Nov 2024 11:07:06 -0800 Subject: [PATCH 02/16] hide error --- server/ast/create_table.go | 39 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/server/ast/create_table.go b/server/ast/create_table.go index f5ac52cfbc..a06f7a1f71 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -64,6 +64,27 @@ func nodeCreateTable(node *tree.CreateTable) (*vitess.DDL, error) { Select: selectStmt, } } + var optLike *vitess.OptLike + if len(node.Inherits) > 0 { + if len(node.Defs) > 0 { + // TODO: we should error here, but correctness test are silently passing + // return nil, fmt.Errorf("INHERITS with TableDefs is not yet supported") + } + for i, table := range node.Inherits { + if i > 0 { + return nil, fmt.Errorf("Multiple INHERITS is not yet supported") + } + // TODO: until we can support multiple tables in LIKE statements, this will only run once + likeTable, err := nodeTableName(&table) + if err != nil { + return nil, err + } + optLike = &vitess.OptLike{ + LikeTable: likeTable, + } + } + } + if node.WithNoData { return nil, fmt.Errorf("WITH NO DATA is not yet supported") } @@ -73,27 +94,11 @@ func nodeCreateTable(node *tree.CreateTable) (*vitess.DDL, error) { IfNotExists: node.IfNotExists, Temporary: isTemporary, OptSelect: optSelect, + OptLike: optLike, } if err = assignTableDefs(node.Defs, ddl); err != nil { return nil, err } - for i, table := range node.Inherits { - // TODO: also check for schemas along with inherits - if i > 0 { - return nil, fmt.Errorf("Multiple INHERITS is not yet supported") - } - if len(node.Defs) > 0 { - return nil, fmt.Errorf("INHERITS with TableDefs is not yet supported") - } - likeTable, err := nodeTableName(&table) - if err != nil { - return nil, err - } - optLike := &vitess.OptLike{ - LikeTable: likeTable, - } - ddl.OptLike = optLike - } if node.PartitionBy != nil { switch node.PartitionBy.Type { From 70feb9a05e7c0728b6d431889292ae2372a04ab1 Mon Sep 17 00:00:00 2001 From: James Cor Date: Thu, 7 Nov 2024 11:13:40 -0800 Subject: [PATCH 03/16] make linter happy --- server/ast/create_table.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/ast/create_table.go b/server/ast/create_table.go index a06f7a1f71..134655d2d1 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -66,10 +66,10 @@ func nodeCreateTable(node *tree.CreateTable) (*vitess.DDL, error) { } var optLike *vitess.OptLike if len(node.Inherits) > 0 { - if len(node.Defs) > 0 { - // TODO: we should error here, but correctness test are silently passing - // return nil, fmt.Errorf("INHERITS with TableDefs is not yet supported") - } + // TODO: we should error here, but correctness test are silently passing + //if len(node.Defs) > 0 { + // return nil, fmt.Errorf("INHERITS with TableDefs is not yet supported") + //} for i, table := range node.Inherits { if i > 0 { return nil, fmt.Errorf("Multiple INHERITS is not yet supported") From 1d0d035ccc9f0d9c645d26242096472dfa3042fd Mon Sep 17 00:00:00 2001 From: James Cor Date: Thu, 7 Nov 2024 11:53:01 -0800 Subject: [PATCH 04/16] cover up more errors --- server/ast/create_table.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/ast/create_table.go b/server/ast/create_table.go index 134655d2d1..8accc39b2f 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -72,7 +72,9 @@ func nodeCreateTable(node *tree.CreateTable) (*vitess.DDL, error) { //} for i, table := range node.Inherits { if i > 0 { - return nil, fmt.Errorf("Multiple INHERITS is not yet supported") + // TODO: we should error here, but correctness test are silently passing + //return nil, fmt.Errorf("Multiple INHERITS is not yet supported") + break } // TODO: until we can support multiple tables in LIKE statements, this will only run once likeTable, err := nodeTableName(&table) From 9151b77f3989b471524f90f11dd9670846a9e40a Mon Sep 17 00:00:00 2001 From: James Cor Date: Thu, 7 Nov 2024 16:54:25 -0800 Subject: [PATCH 05/16] bump and implement --- go.mod | 4 ++-- go.sum | 8 ++++---- server/ast/create_table.go | 28 +++++++++------------------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index 85e82759b1..33e07b5553 100644 --- a/go.mod +++ b/go.mod @@ -12,9 +12,9 @@ require ( github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df 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.20241104142123-e00c563047c0 + github.com/dolthub/go-mysql-server v0.18.2-0.20241108005244-2375a54b2f37 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 - github.com/dolthub/vitess v0.0.0-20241104125316-860772ba6683 + github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e github.com/fatih/color v1.13.0 github.com/goccy/go-json v0.10.2 github.com/gogo/protobuf v1.3.2 diff --git a/go.sum b/go.sum index 26e4c335b5..296ba20ec9 100644 --- a/go.sum +++ b/go.sum @@ -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.20241104142123-e00c563047c0 h1:89pFCcn78El3hYvNK11Vx9ez2bQAGSrMu6CLFO0BdXQ= -github.com/dolthub/go-mysql-server v0.18.2-0.20241104142123-e00c563047c0/go.mod h1:0xWs/FBE4xlhlOsAWoGh24SDRHemT7/U1nApu7SNRXg= +github.com/dolthub/go-mysql-server v0.18.2-0.20241108005244-2375a54b2f37 h1:IWY0XdXL03vsxuMOteOoJ0HFrFGrHyUB6mcVR+BI8C8= +github.com/dolthub/go-mysql-server v0.18.2-0.20241108005244-2375a54b2f37/go.mod h1:mdsUjaedg9okGlEGEUOzCYZHfjC+ZoO6WqL7yZpX87c= 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= @@ -238,8 +238,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 h1:JWkKRE4 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216/go.mod h1:e/FIZVvT2IR53HBCAo41NjqgtEnjMJGKca3Y/dAmZaA= github.com/dolthub/swiss v0.1.0 h1:EaGQct3AqeP/MjASHLiH6i4TAmgbG/c4rA6a1bzCOPc= github.com/dolthub/swiss v0.1.0/go.mod h1:BeucyB08Vb1G9tumVN3Vp/pyY4AMUnr9p7Rz7wJ7kAQ= -github.com/dolthub/vitess v0.0.0-20241104125316-860772ba6683 h1:2/RJeUfNAXS7mbBnEr9C36htiCJHk5XldDPzhxtEsME= -github.com/dolthub/vitess v0.0.0-20241104125316-860772ba6683/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= +github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e h1:LzLeTanHHI4h75GGqo7GVlFZsOpR6VOn5j3ug+a3+R8= +github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= diff --git a/server/ast/create_table.go b/server/ast/create_table.go index 8accc39b2f..6673635401 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -66,27 +66,17 @@ func nodeCreateTable(node *tree.CreateTable) (*vitess.DDL, error) { } var optLike *vitess.OptLike if len(node.Inherits) > 0 { - // TODO: we should error here, but correctness test are silently passing - //if len(node.Defs) > 0 { - // return nil, fmt.Errorf("INHERITS with TableDefs is not yet supported") - //} - for i, table := range node.Inherits { - if i > 0 { - // TODO: we should error here, but correctness test are silently passing - //return nil, fmt.Errorf("Multiple INHERITS is not yet supported") - break - } - // TODO: until we can support multiple tables in LIKE statements, this will only run once - likeTable, err := nodeTableName(&table) - if err != nil { - return nil, err - } - optLike = &vitess.OptLike{ - LikeTable: likeTable, - } + optLike = &vitess.OptLike{ + LikeTables: []vitess.TableName{}, } + for _, table := range node.Inherits { + // TODO: until we can support multiple tables in LIKE statements, this will only run once + likeTable, err := nodeTableName(&table) + if err != nil { + return nil, err + } + optLike.LikeTables = append(optLike.LikeTables, likeTable) } - if node.WithNoData { return nil, fmt.Errorf("WITH NO DATA is not yet supported") } From 61cae1adb3e96f3e514d15d6acec3477b7c6197a Mon Sep 17 00:00:00 2001 From: James Cor Date: Thu, 7 Nov 2024 16:56:21 -0800 Subject: [PATCH 06/16] oops --- server/ast/create_table.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/ast/create_table.go b/server/ast/create_table.go index 6673635401..d098c83c78 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -70,12 +70,12 @@ func nodeCreateTable(node *tree.CreateTable) (*vitess.DDL, error) { LikeTables: []vitess.TableName{}, } for _, table := range node.Inherits { - // TODO: until we can support multiple tables in LIKE statements, this will only run once - likeTable, err := nodeTableName(&table) - if err != nil { - return nil, err + likeTable, err := nodeTableName(&table) + if err != nil { + return nil, err + } + optLike.LikeTables = append(optLike.LikeTables, likeTable) } - optLike.LikeTables = append(optLike.LikeTables, likeTable) } if node.WithNoData { return nil, fmt.Errorf("WITH NO DATA is not yet supported") From 0f9a6319aaae712142a4e229434fed030bff64ae Mon Sep 17 00:00:00 2001 From: James Cor Date: Fri, 8 Nov 2024 01:18:10 -0800 Subject: [PATCH 07/16] fix --- server/ast/table_def.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ast/table_def.go b/server/ast/table_def.go index d1d521832d..4fc3548352 100644 --- a/server/ast/table_def.go +++ b/server/ast/table_def.go @@ -88,7 +88,7 @@ func assignTableDef(node tree.TableDef, target *vitess.DDL) error { return err } target.OptLike = &vitess.OptLike{ - LikeTable: tableName, + LikeTables: []vitess.TableName{tableName}, } return nil case *tree.UniqueConstraintTableDef: From eaf4c577a649b1026566a0b3b022cb469c7e1e8a Mon Sep 17 00:00:00 2001 From: James Cor Date: Fri, 8 Nov 2024 02:03:37 -0800 Subject: [PATCH 08/16] asdf --- server/ast/create_table.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ast/create_table.go b/server/ast/create_table.go index 5999a36854..cc9027604c 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -70,7 +70,7 @@ func nodeCreateTable(ctx *Context, node *tree.CreateTable) (*vitess.DDL, error) LikeTables: []vitess.TableName{}, } for _, table := range node.Inherits { - likeTable, err := nodeTableName(&table) + likeTable, err := nodeTableName(ctx, &table) if err != nil { return nil, err } From 65d3e9ea0273cff19c613584e7a5ce92bd40cae6 Mon Sep 17 00:00:00 2001 From: James Cor Date: Fri, 8 Nov 2024 11:02:58 -0800 Subject: [PATCH 09/16] bump --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e9d4d95434..e530bd7b07 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df 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.20241108005244-2375a54b2f37 + github.com/dolthub/go-mysql-server v0.18.2-0.20241108185903-b2de759fca1c github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e github.com/fatih/color v1.13.0 diff --git a/go.sum b/go.sum index 0eee11753e..1a7688dffc 100644 --- a/go.sum +++ b/go.sum @@ -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.20241108005244-2375a54b2f37 h1:IWY0XdXL03vsxuMOteOoJ0HFrFGrHyUB6mcVR+BI8C8= -github.com/dolthub/go-mysql-server v0.18.2-0.20241108005244-2375a54b2f37/go.mod h1:mdsUjaedg9okGlEGEUOzCYZHfjC+ZoO6WqL7yZpX87c= +github.com/dolthub/go-mysql-server v0.18.2-0.20241108185903-b2de759fca1c h1:huFI8SDGH3qy9YRPvzXQCYsdJl1Wkikdzlh8aGxRnvg= +github.com/dolthub/go-mysql-server v0.18.2-0.20241108185903-b2de759fca1c/go.mod h1:mdsUjaedg9okGlEGEUOzCYZHfjC+ZoO6WqL7yZpX87c= 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= From 0dd97e1f6045d4ecb7390a47a6835849f8c4936c Mon Sep 17 00:00:00 2001 From: James Cor Date: Fri, 8 Nov 2024 11:56:36 -0800 Subject: [PATCH 10/16] bump2 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e530bd7b07..fd46cd5f43 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df 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.20241108185903-b2de759fca1c + github.com/dolthub/go-mysql-server v0.18.2-0.20241108193559-14a7c3c42a21 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e github.com/fatih/color v1.13.0 diff --git a/go.sum b/go.sum index 1a7688dffc..e80e99fc4b 100644 --- a/go.sum +++ b/go.sum @@ -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.20241108185903-b2de759fca1c h1:huFI8SDGH3qy9YRPvzXQCYsdJl1Wkikdzlh8aGxRnvg= -github.com/dolthub/go-mysql-server v0.18.2-0.20241108185903-b2de759fca1c/go.mod h1:mdsUjaedg9okGlEGEUOzCYZHfjC+ZoO6WqL7yZpX87c= +github.com/dolthub/go-mysql-server v0.18.2-0.20241108193559-14a7c3c42a21 h1:JnVfGI7W5xA04Cv8R9wjphZDoVqVQ5bpVYcPtlqjbto= +github.com/dolthub/go-mysql-server v0.18.2-0.20241108193559-14a7c3c42a21/go.mod h1:mdsUjaedg9okGlEGEUOzCYZHfjC+ZoO6WqL7yZpX87c= 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= From c311be6a64f7e651e05d871e62cc07ea56d10b3c Mon Sep 17 00:00:00 2001 From: James Cor Date: Fri, 8 Nov 2024 13:54:07 -0800 Subject: [PATCH 11/16] enginetests --- testing/go/create_table_test.go | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/testing/go/create_table_test.go b/testing/go/create_table_test.go index c4f1c174fa..434df2b44c 100755 --- a/testing/go/create_table_test.go +++ b/testing/go/create_table_test.go @@ -159,3 +159,63 @@ func TestCreateTable(t *testing.T) { }, }) } + +func TestCreateTableInherit(t *testing.T) { + RunScripts(t, []ScriptTest{ + { + Name: "Create table with inheritance", + SetUpScript: []string{ + "create table t1 (a int);", + "create table t2 (b int);", + "create table t3 (c int);", + "create table t11 (a int);", + }, + Assertions: []ScriptTestAssertion{ + { + Query: "create table t4 (d int) inherits (t1, t2, t3);", + Expected: []sql.Row{}, + }, + { + Query: "insert into t4 values (1, 2, 3, 4);", + Expected: []sql.Row{}, + }, + { + Query: "select * from t4;", + Expected: []sql.Row{ + {1, 2, 3, 4}, + }, + }, + + { + Query: "create table t111 () inherits (t1, t11);", + Expected: []sql.Row{}, + }, + { + Query: "insert into t111 values (1);", + Expected: []sql.Row{}, + }, + { + Query: "select * from t111;", + Expected: []sql.Row{ + {1}, + }, + }, + + { + Query: "create table t1t1 (a int) inherits (t1);", + Expected: []sql.Row{}, + }, + { + Query: "insert into t1t1 values (1);", + Expected: []sql.Row{}, + }, + { + Query: "select * from t1t1;", + Expected: []sql.Row{ + {1}, + }, + }, + }, + }, + }) +} From 0ea90efd6e8b42ec22a114f20cd15d148fbc1290 Mon Sep 17 00:00:00 2001 From: James Cor Date: Fri, 8 Nov 2024 14:14:22 -0800 Subject: [PATCH 12/16] formatting --- testing/go/create_table_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/go/create_table_test.go b/testing/go/create_table_test.go index 434df2b44c..ce210d4e4e 100755 --- a/testing/go/create_table_test.go +++ b/testing/go/create_table_test.go @@ -180,7 +180,7 @@ func TestCreateTableInherit(t *testing.T) { Expected: []sql.Row{}, }, { - Query: "select * from t4;", + Query: "select * from t4;", Expected: []sql.Row{ {1, 2, 3, 4}, }, @@ -195,7 +195,7 @@ func TestCreateTableInherit(t *testing.T) { Expected: []sql.Row{}, }, { - Query: "select * from t111;", + Query: "select * from t111;", Expected: []sql.Row{ {1}, }, @@ -210,7 +210,7 @@ func TestCreateTableInherit(t *testing.T) { Expected: []sql.Row{}, }, { - Query: "select * from t1t1;", + Query: "select * from t1t1;", Expected: []sql.Row{ {1}, }, From a65f146c2fe66feedfe672207888ad41820c99f5 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 11 Nov 2024 11:09:53 -0800 Subject: [PATCH 13/16] order and case insensitive tests --- testing/go/create_table_test.go | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/testing/go/create_table_test.go b/testing/go/create_table_test.go index ce210d4e4e..9cef45a40a 100755 --- a/testing/go/create_table_test.go +++ b/testing/go/create_table_test.go @@ -176,11 +176,11 @@ func TestCreateTableInherit(t *testing.T) { Expected: []sql.Row{}, }, { - Query: "insert into t4 values (1, 2, 3, 4);", + Query: "insert into t4(a, b, c, d) values (1, 2, 3, 4);", Expected: []sql.Row{}, }, { - Query: "select * from t4;", + Query: "select a, b, c, d from t4;", Expected: []sql.Row{ {1, 2, 3, 4}, }, @@ -191,7 +191,7 @@ func TestCreateTableInherit(t *testing.T) { Expected: []sql.Row{}, }, { - Query: "insert into t111 values (1);", + Query: "insert into t111(a) values (1);", Expected: []sql.Row{}, }, { @@ -206,7 +206,7 @@ func TestCreateTableInherit(t *testing.T) { Expected: []sql.Row{}, }, { - Query: "insert into t1t1 values (1);", + Query: "insert into t1t1(a) values (1);", Expected: []sql.Row{}, }, { @@ -215,6 +215,21 @@ func TestCreateTableInherit(t *testing.T) { {1}, }, }, + + { + Query: "create table TT1t1 (A int) inherits (t1);", + Expected: []sql.Row{}, + }, + { + Query: "insert into TT1t1(a) values (1);", + Expected: []sql.Row{}, + }, + { + Query: "select * from TT1t1;", + Expected: []sql.Row{ + {1}, + }, + }, }, }, }) From b06ecfb6247f0fa6d5f2087ad179b7fb7c5f62c6 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 11 Nov 2024 11:22:48 -0800 Subject: [PATCH 14/16] fix test --- testing/go/create_table_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/go/create_table_test.go b/testing/go/create_table_test.go index 9cef45a40a..46adf15f49 100755 --- a/testing/go/create_table_test.go +++ b/testing/go/create_table_test.go @@ -180,7 +180,7 @@ func TestCreateTableInherit(t *testing.T) { Expected: []sql.Row{}, }, { - Query: "select a, b, c, d from t4;", + Query: "select * from t4;", Expected: []sql.Row{ {1, 2, 3, 4}, }, From a721c29cd287b6899ac8545d7d7435101b1efdd1 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 11 Nov 2024 16:25:33 -0800 Subject: [PATCH 15/16] bump --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fd46cd5f43..1a3a22568e 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df 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.20241108193559-14a7c3c42a21 + github.com/dolthub/go-mysql-server v0.18.2-0.20241111230617-3bcd7562b5e2 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e github.com/fatih/color v1.13.0 diff --git a/go.sum b/go.sum index e80e99fc4b..15dcf598e3 100644 --- a/go.sum +++ b/go.sum @@ -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.20241108193559-14a7c3c42a21 h1:JnVfGI7W5xA04Cv8R9wjphZDoVqVQ5bpVYcPtlqjbto= -github.com/dolthub/go-mysql-server v0.18.2-0.20241108193559-14a7c3c42a21/go.mod h1:mdsUjaedg9okGlEGEUOzCYZHfjC+ZoO6WqL7yZpX87c= +github.com/dolthub/go-mysql-server v0.18.2-0.20241111230617-3bcd7562b5e2 h1:x3Nu5o+g4pPlrOGktEBagJr3PSftyaUCbgSCj/SDCVs= +github.com/dolthub/go-mysql-server v0.18.2-0.20241111230617-3bcd7562b5e2/go.mod h1:0xWs/FBE4xlhlOsAWoGh24SDRHemT7/U1nApu7SNRXg= 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= From 8dcc97801a00336d9bfb2c69995803c3f5817555 Mon Sep 17 00:00:00 2001 From: James Cor Date: Tue, 12 Nov 2024 12:14:17 -0800 Subject: [PATCH 16/16] bump --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 1a3a22568e..398c5c5160 100644 --- a/go.mod +++ b/go.mod @@ -8,13 +8,13 @@ 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.20241107181811-5fb8fb1de09f + github.com/dolthub/dolt/go v0.40.5-0.20241112201149-884cb4dfd05d github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df 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.20241111230617-3bcd7562b5e2 + github.com/dolthub/go-mysql-server v0.18.2-0.20241112002228-81b13e8034f2 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 - github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e + github.com/dolthub/vitess v0.0.0-20241111235433-a20a5ab9d7c9 github.com/fatih/color v1.13.0 github.com/goccy/go-json v0.10.2 github.com/gogo/protobuf v1.3.2 diff --git a/go.sum b/go.sum index 15dcf598e3..e4db382a2a 100644 --- a/go.sum +++ b/go.sum @@ -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.20241107181811-5fb8fb1de09f h1:ToPae847z15nTPgKctIQ8BxV3BeavwlFwD2+RF1ULns= -github.com/dolthub/dolt/go v0.40.5-0.20241107181811-5fb8fb1de09f/go.mod h1:+dAesRR4iX14RVxtuxXEOzHSo83j1OZzJdLA23uXVk0= +github.com/dolthub/dolt/go v0.40.5-0.20241112201149-884cb4dfd05d h1:SO65wh7ejG7CH8DemQ4fBNimSeeUlADI2roJPKSjjCU= +github.com/dolthub/dolt/go v0.40.5-0.20241112201149-884cb4dfd05d/go.mod h1:wERbbFV05JV9OsGqUBrnCpgN3UEdMsFNGRsEDPwQZKY= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df h1:xafyaNR+hSk5TwOhmNkhhrmOZKIOkxAOCiIEUzlIybc= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df/go.mod h1:L5RDYZbC9BBWmoU2+TjTekeqqhFXX5EqH9ln00O0stY= github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww= @@ -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.20241111230617-3bcd7562b5e2 h1:x3Nu5o+g4pPlrOGktEBagJr3PSftyaUCbgSCj/SDCVs= -github.com/dolthub/go-mysql-server v0.18.2-0.20241111230617-3bcd7562b5e2/go.mod h1:0xWs/FBE4xlhlOsAWoGh24SDRHemT7/U1nApu7SNRXg= +github.com/dolthub/go-mysql-server v0.18.2-0.20241112002228-81b13e8034f2 h1:1ax2e+4r9ax5eiowBEIfRX7K/oZLeWxNNtt88CgnO0I= +github.com/dolthub/go-mysql-server v0.18.2-0.20241112002228-81b13e8034f2/go.mod h1:sOMQzWUvHvJECzpcUxjDgV5BR/A7U+hOh596PUO2NPI= 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= @@ -238,8 +238,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 h1:JWkKRE4 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216/go.mod h1:e/FIZVvT2IR53HBCAo41NjqgtEnjMJGKca3Y/dAmZaA= github.com/dolthub/swiss v0.1.0 h1:EaGQct3AqeP/MjASHLiH6i4TAmgbG/c4rA6a1bzCOPc= github.com/dolthub/swiss v0.1.0/go.mod h1:BeucyB08Vb1G9tumVN3Vp/pyY4AMUnr9p7Rz7wJ7kAQ= -github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e h1:LzLeTanHHI4h75GGqo7GVlFZsOpR6VOn5j3ug+a3+R8= -github.com/dolthub/vitess v0.0.0-20241108004726-fd871a8e800e/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= +github.com/dolthub/vitess v0.0.0-20241111235433-a20a5ab9d7c9 h1:s36zDuLPuZRWC0nBCJs2Z8joP19eKEtcsIsuE8K9Kx0= +github.com/dolthub/vitess v0.0.0-20241111235433-a20a5ab9d7c9/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=