Skip to content

Commit

Permalink
Merge pull request #556 from tablelandnetwork/bcalza/fixvalidation
Browse files Browse the repository at this point in the history
fix table's name validation
  • Loading branch information
brunocalza authored May 3, 2023
2 parents d5f8130 + 49ae19f commit eb20830
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/sethvargo/go-limiter v0.7.2
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.2
github.com/tablelandnetwork/sqlparser v0.0.0-20230420192826-7c549ca44bf8
github.com/tablelandnetwork/sqlparser v0.0.0-20230502232446-6e10f18895a3
github.com/textileio/cli v1.0.2
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0
go.opentelemetry.io/otel v1.14.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,10 @@ github.com/tablelandnetwork/sqlparser v0.0.0-20230328132500-785ebca8e351 h1:aHuH
github.com/tablelandnetwork/sqlparser v0.0.0-20230328132500-785ebca8e351/go.mod h1:S+M/v3Q8X+236kQxMQziFcLId2Cscb1LzW06IUVhljE=
github.com/tablelandnetwork/sqlparser v0.0.0-20230420192826-7c549ca44bf8 h1:mC58HOJfkfPsqetYd4hpCp0ey5qb9/ZkIRZEx+d2b4U=
github.com/tablelandnetwork/sqlparser v0.0.0-20230420192826-7c549ca44bf8/go.mod h1:S+M/v3Q8X+236kQxMQziFcLId2Cscb1LzW06IUVhljE=
github.com/tablelandnetwork/sqlparser v0.0.0-20230502223534-5872144545c4 h1:YjROwj4D7PXJbKCNdpTZJM8TpfKhdFgdzzjh3RTY1wo=
github.com/tablelandnetwork/sqlparser v0.0.0-20230502223534-5872144545c4/go.mod h1:S+M/v3Q8X+236kQxMQziFcLId2Cscb1LzW06IUVhljE=
github.com/tablelandnetwork/sqlparser v0.0.0-20230502232446-6e10f18895a3 h1:QyOUHf3JEz3p3JrijVHRggaPKahuJLuxyslxlMmuXAc=
github.com/tablelandnetwork/sqlparser v0.0.0-20230502232446-6e10f18895a3/go.mod h1:S+M/v3Q8X+236kQxMQziFcLId2Cscb1LzW06IUVhljE=
github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I=
github.com/textileio/cli v1.0.2 h1:qSp/x4d/9SZ93TxhgZnE5okRKqzqHqrzAwKAPjuPw50=
github.com/textileio/cli v1.0.2/go.mod h1:vTlCvvVyOmXXLwddCcBg3PDavfUsCkRBZoyr6Nu1lkc=
Expand Down
4 changes: 2 additions & 2 deletions pkg/eventprocessor/impl/eventprocessor_replayhistory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ func TestReplayProductionHistory(t *testing.T) {

expectedStateHashes := map[tableland.ChainID]string{
1: "bce26781eed109b8aaae2d1f688c134831fdf061",
5: "f141373c03aee3a74595538abba81cd1c3755f63",
5: "21684ad97813634841393a097436e397de96692f",
10: "1aa835eec9a9ac08cc2784d9d29df7fb15409d08",
69: "fd1ba648c9406c0af321cb734eb203c742fff2a3",
137: "fd1da780698b394a352b59e9b0c124f9cf010b67",
420: "639dda72b6e4a5a8ef7ceb2b734e0b6ecc241407",
80001: "f5bc53afc7525e9ff1f337bad8e9d4e9cb1ad111",
80001: "50d477f69179aa0b027c8df7661666c7b5676699",
421613: "d58fd380066628fa92fd8a87831ea744b9ba1d8b",
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/parsing/impl/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,14 @@ func TestCreateTableChecks(t *testing.T) {
chainID: 1337,
expErrType: ptr2ErrKeywordIsNotAllowed(),
},

// Table name
{
name: "enclosed table name",
query: "CREATE TABLE [users_31337] (id integer NOT NULL)",
chainID: 31337,
expErrType: nil,
},
}

for _, it := range tests {
Expand Down

0 comments on commit eb20830

Please sign in to comment.