Files
dolthub--doltgresql/testing/go/enginetest/doltgres_engine_test.go
T
2026-07-13 12:32:25 +08:00

1739 lines
58 KiB
Go
Executable File

// Copyright 2020 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package enginetest
import (
"context"
"os"
"regexp"
"runtime"
"testing"
denginetest "github.com/dolthub/dolt/go/libraries/doltcore/sqle/enginetest"
"github.com/dolthub/go-mysql-server/enginetest"
"github.com/dolthub/go-mysql-server/enginetest/queries"
"github.com/dolthub/go-mysql-server/enginetest/scriptgen/setup"
"github.com/dolthub/go-mysql-server/sql"
"github.com/dolthub/go-mysql-server/sql/types"
"github.com/stretchr/testify/require"
"github.com/dolthub/dolt/go/libraries/doltcore/dtestutils"
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/doltcore/schema/typeinfo"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle"
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
"github.com/dolthub/dolt/go/libraries/utils/config"
)
func init() {
sqle.MinRowsPerPartition = 8
sqle.MaxRowsPerPartition = 1024
}
func TestQueries(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestQueries(t, h)
}
func TestSingleWriteQuery(t *testing.T) {
// t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
h.Setup(setup.MydbData, setup.AutoincrementData)
test := queries.WriteQueryTest{
WriteQuery: "INSERT INTO auto_increment_tbl (c0) values (44)",
ExpectedWriteResult: []sql.Row{{types.OkResult{RowsAffected: 1, InsertID: 4}}},
SelectQuery: "SELECT * FROM auto_increment_tbl ORDER BY pk",
ExpectedSelect: []sql.Row{
{1, 11},
{2, 22},
{3, 33},
{4, 44},
},
}
enginetest.RunWriteQueryTest(t, h, test)
}
func TestSingleQuery(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
harness.Setup(setup.SimpleSetup...)
engine, err := harness.NewEngine(t)
if err != nil {
panic(err)
}
setupQueries := []string{
// "create table t1 (pk int primary key, c int);",
// "insert into t1 values (1,2), (3,4)",
// "call dolt_add('.')",
// "set @Commit1 = dolt_commit('-am', 'initial table');",
// "insert into t1 values (5,6), (7,8)",
// "set @Commit2 = dolt_commit('-am', 'two more rows');",
}
for _, q := range setupQueries {
enginetest.RunQueryWithContext(t, engine, harness, nil, q)
}
// engine.EngineAnalyzer().Debug = true
// engine.EngineAnalyzer().Verbose = true
test := queries.QueryTest{
Query: `show create table mytable`,
Expected: []sql.Row{
{"mytable",
"CREATE TABLE `mytable` (\n" +
" `i` bigint NOT NULL,\n" +
" `s` varchar(20) NOT NULL COMMENT 'column s',\n" +
" PRIMARY KEY (`i`),\n" +
" KEY `idx_si` (`s`,`i`),\n" +
" KEY `mytable_i_s` (`i`,`s`),\n" +
" UNIQUE KEY `mytable_s` (`s`)\n" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"},
},
}
enginetest.TestQueryWithEngine(t, harness, engine, test)
}
func TestSchemaOverrides(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunSchemaOverridesTest(t, harness)
}
type doltCommitValidator struct{}
var _ enginetest.CustomValueValidator = &doltCommitValidator{}
// TODO: this custom validator is supposed to match only a commit hash, but we extend it to match the formatting
//
// characters present in the Doltgres response for some calls. We can remove this when we support the syntax
// `select * from dolt_commit(...)`
var hashRegex = regexp.MustCompile(`^\{?([0-9a-v]{32}).*$`)
// Validate returns true if the value is a valid commit hash.
func (dcv *doltCommitValidator) Validate(val interface{}) (bool, error) {
hash, ok := val.(string)
if !ok {
return false, nil
}
return hashRegex.MatchString(hash), nil
}
// CommitHash returns the commit hash from the value, if it is a valid commit hash.
func (dcv *doltCommitValidator) CommitHash(val interface{}) (bool, string) {
hash, ok := val.(string)
if !ok {
return false, ""
}
matches := hashRegex.FindStringSubmatch(hash)
if len(matches) == 0 {
return false, ""
}
return true, matches[1]
}
// Convenience test for debugging a single query. Unskip and set to the desired query.
func TestSingleScript(t *testing.T) {
t.Skip()
var scripts = []queries.ScriptTest{}
for _, script := range scripts {
func() {
harness := newDoltgresServerHarness(t)
defer harness.Close()
// harness.Setup(setup.MydbData, setup.MytableData)
engine, err := harness.NewEngine(t)
if err != nil {
panic(err)
}
engine.EngineAnalyzer().Debug = true
engine.EngineAnalyzer().Verbose = true
enginetest.TestScriptWithEngine(t, engine, harness, script)
}()
}
}
func TestAutoIncrementTrackerLockMode(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunAutoIncrementTrackerLockModeTest(t, harness)
}
func TestVersionedQueries(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
// MySQL-only `cast(... as signed)` syntax — postgres uses `cast(... as integer)`.
// These views aren't referenced by the assertions, so dropping them from
// setup is harmless.
"cast(RIGHT(s, 1) as signed)",
// AS OF tests on these complex views; they depend on views we can't create.
"myview4", "myview5",
// SHOW CREATE TABLE AS OF — doltgres doesn't yet expose the AS OF clause
// to SHOW CREATE TABLE (it errors with "at or near 'as'").
"SHOW CREATE TABLE myhistorytable as of",
// SHOW TABLES AS OF and DESCRIBE AS OF likewise unsupported.
"SHOW TABLES AS OF",
"SHOW TABLES FROM mydb AS OF",
"DESCRIBE myhistorytable AS OF",
})
defer h.Close()
denginetest.RunVersionedQueriesTest(t, h)
}
func TestAnsiQuotesSqlMode(t *testing.T) {
t.Skip()
enginetest.TestAnsiQuotesSqlMode(t, newDoltgresServerHarness(t))
}
// Tests of choosing the correct execution plan independent of result correctness. Mostly useful for confirming that
// the right indexes are being used for joining tables.
func TestQueryPlans(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunQueryTestPlans(t, harness)
}
func TestIntegrationQueryPlans(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t).WithConfigureStats(true)
defer harness.Close()
enginetest.TestIntegrationPlans(t, harness)
}
func TestDoltDiffQueryPlans(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t).WithParallelism(2) // want Exchange nodes
denginetest.RunDoltDiffQueryPlansTest(t, harness)
}
func TestBranchPlans(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunBranchPlanTests(t, harness)
}
func TestQueryErrors(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestQueryErrors(t, h)
}
func TestInfoSchema(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunInfoSchemaTests(t, h)
}
func TestColumnAliases(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"SELECT s as Date, SUM(i) TimeStamp FROM mytable group by 1 order by 2", // ERROR: at or near "timestamp": syntax error
"SELECT 1 as a, (select a) as b from dual", // table not found: dual
})
defer h.Close()
enginetest.TestColumnAliases(t, h)
}
func TestOrderByGroupBy(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"Group by with decimal columns", // syntax error
"Validation for use of non-aggregated columns with implicit grouping of all rows", // bad error matching
"group by with any_value()", // @@ vars not supported
"group by with strict errors", // @@ vars not supported
})
defer h.Close()
enginetest.TestOrderByGroupBy(t, h)
}
func TestAmbiguousColumnResolution(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestAmbiguousColumnResolution(t, h)
}
func TestInsertInto(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"with t (i,f) as (select 4,'fourth row' from dual) insert into mytable select i,f from t", // WITH unsupported syntax
"with recursive t (i,f) as (select 4,4 from dual union all select i + 1, i + 1 from t where i < 5) insert into mytable select i,f from t", // WITH unsupported syntax
"issue 6675: on duplicate rearranged getfield indexes from select source", // panic
"Insert on duplicate key references table in subquery", // bad translation?
"Insert on duplicate key references table in aliased subquery", // bad translation?
"Insert on duplicate key references table in cte", // CTE not supported
"insert on duplicate key with incorrect row alias", // column "c" could not be found in any table in scope
"insert on duplicate key update errors", // failing
"INSERT INTO ... SELECT with TEXT types", // typecasts needed
})
defer h.Close()
enginetest.TestInsertInto(t, h)
}
func TestInsertIgnoreInto(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"Test that INSERT IGNORE properly addresses data conversion", // postgres strict typing rejects MySQL coercions
"Insert Ignore works correctly with ON DUPLICATE UPDATE", // postgres strict typing rejects MySQL coercions
"issue 8611: insert ignore on enum type column", // enums not supported
})
defer h.Close()
enginetest.TestInsertIgnoreInto(t, h)
}
func TestInsertDuplicateKeyKeyless(t *testing.T) {
enginetest.TestInsertDuplicateKeyKeyless(t, newDoltgresServerHarness(t))
}
func TestIgnoreIntoWithDuplicateUniqueKeyKeyless(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"UPDATE IGNORE keyless tables and secondary indexes", // UPDATE IGNORE rewrite doesn't perform the actual update
})
defer h.Close()
enginetest.TestIgnoreIntoWithDuplicateUniqueKeyKeyless(t, h)
}
func TestInsertIntoErrors(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunInsertIntoErrorsTest(t, h)
}
func TestGeneratedColumns(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunGeneratedColumnTests(t, harness)
}
func TestGeneratedColumnPlans(t *testing.T) {
t.Skip()
enginetest.TestGeneratedColumnPlans(t, newDoltgresServerHarness(t))
}
func TestSpatialQueries(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestSpatialQueries(t, h)
}
func TestReplaceInto(t *testing.T) {
// REPLACE INTO is rewritten to INSERT ... ON CONFLICT DO UPDATE in the
// converter. Two classes of test still fail:
// - VALUES form with no column list (e.g. `REPLACE INTO t VALUES (...)`):
// the converter needs the column list to build the SET clause and bails.
// - Replacing a row with identical values: postgres/MySQL ON DUPLICATE KEY
// UPDATE reports 0 rows affected when the update is a no-op, but MySQL
// REPLACE INTO reports 2 (DELETE + INSERT). These are real semantic
// differences; we'd need to override the rowcount to make them match.
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"REPLACE INTO mytable VALUES (1, 'first row')", // no-column REPLACE; bails to raw syntax
"REPLACE INTO mytable VALUES (1, 'new row same i')", // no-column REPLACE; bails to raw syntax
"REPLACE INTO mytable VALUES (999, 'x')", // no-column REPLACE; bails to raw syntax
"REPLACE INTO mytable SET i = 1, s = 'first row'", // no-op update reports 0 rows, expected 2
})
defer h.Close()
enginetest.TestReplaceInto(t, h)
}
func TestReplaceIntoErrors(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestReplaceIntoErrors(t, h)
}
func TestUpdate(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"UPDATE mytable SET s = _binary 'updated' WHERE i = 3;", // _binary not supported
"UPDATE mytable SET s = 'updated' ORDER BY i LIMIT 1 OFFSET 1;", // offset not supported (limit isn't selected in vanilla postgres but is in the cockroach grammar)
// TODO: Postgres supports update joins but with a very different syntax, and some join types are not supported
`UPDATE one_pk INNER JOIN two_pk on one_pk.pk = two_pk.pk1 SET two_pk.c1 = two_pk.c1 + 1`,
"UPDATE mytable INNER JOIN one_pk ON mytable.i = one_pk.c5 SET mytable.i = mytable.i * 10",
`UPDATE one_pk INNER JOIN two_pk on one_pk.pk = two_pk.pk1 INNER JOIN othertable on othertable.i2 = two_pk.pk2 SET one_pk.c1 = one_pk.c1 + 1`,
`UPDATE one_pk INNER JOIN (SELECT * FROM two_pk order by pk1, pk2) as t2 on one_pk.pk = t2.pk1 SET one_pk.c1 = t2.c1 + 1 where one_pk.pk < 1`,
`UPDATE one_pk INNER JOIN two_pk on one_pk.pk = two_pk.pk1 SET one_pk.c1 = one_pk.c1 + 1`,
`update mytable h join mytable on h.i = mytable.i and h.s <> mytable.s set h.i = mytable.i+1;`,
`UPDATE othertable CROSS JOIN tabletest set othertable.i2 = othertable.i2 * 10`, // cross join
`UPDATE tabletest cross join tabletest as t2 set tabletest.i = tabletest.i * 10`, // cross join
`UPDATE othertable cross join tabletest set tabletest.i = tabletest.i * 10`, // cross join
`UPDATE one_pk INNER JOIN two_pk on one_pk.pk = two_pk.pk1 INNER JOIN two_pk a1 on one_pk.pk = two_pk.pk2 SET two_pk.c1 = two_pk.c1 + 1`, // cross join
`UPDATE othertable INNER JOIN tabletest on othertable.i2=3 and tabletest.i=3 SET othertable.s2 = 'fourth'`, // cross join
`UPDATE tabletest cross join tabletest as t2 set t2.i = t2.i * 10`, // cross join
`UPDATE othertable LEFT JOIN tabletest on othertable.i2=3 and tabletest.i=3 SET othertable.s2 = 'fourth'`, // left join
`UPDATE othertable LEFT JOIN tabletest on othertable.i2=3 and tabletest.i=3 SET tabletest.s = 'fourth row', tabletest.i = tabletest.i + 1`, // left join
`UPDATE othertable LEFT JOIN tabletest t3 on othertable.i2=3 and t3.i=3 SET t3.s = 'fourth row', t3.i = t3.i + 1`, // left join
`UPDATE othertable LEFT JOIN tabletest on othertable.i2=3 and tabletest.i=3 LEFT JOIN one_pk on othertable.i2 = one_pk.pk SET one_pk.c1 = one_pk.c1 + 1`, // left join
`UPDATE othertable LEFT JOIN tabletest on othertable.i2=3 and tabletest.i=3 LEFT JOIN one_pk on othertable.i2 = one_pk.pk SET one_pk.c1 = one_pk.c1 + 1 where one_pk.pk > 4`, // left join
`UPDATE othertable LEFT JOIN tabletest on othertable.i2=3 and tabletest.i=3 LEFT JOIN one_pk on othertable.i2 = 1 and one_pk.pk = 1 SET one_pk.c1 = one_pk.c1 + 1`, // left join
`UPDATE othertable RIGHT JOIN tabletest on othertable.i2=3 and tabletest.i=3 SET othertable.s2 = 'fourth'`, // right join
`UPDATE othertable RIGHT JOIN tabletest on othertable.i2=3 and tabletest.i=3 SET othertable.i2 = othertable.i2 + 1`, // right join
`UPDATE othertable LEFT JOIN tabletest on othertable.i2=tabletest.i RIGHT JOIN one_pk on othertable.i2 = 1 and one_pk.pk = 1 SET tabletest.s = 'updated';`, // right join
`UPDATE IGNORE one_pk INNER JOIN two_pk on one_pk.pk = two_pk.pk1 SET two_pk.c1 = two_pk.c1 + 1`,
`UPDATE IGNORE one_pk JOIN one_pk one_pk2 on one_pk.pk = one_pk2.pk SET one_pk.pk = 10`,
`with t (n) as (select (1) from dual) UPDATE mytable set s = concat('updated ', i) where i in (select n from t)`, // with not supported
`with recursive t (n) as (select (1) from dual union all select n + 1 from t where n < 2) UPDATE mytable set s = concat('updated ', i) where i in (select n from t)`,
})
defer h.Close()
enginetest.TestUpdate(t, h)
}
func TestUpdateErrors(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"try updating string that is too long", // works but error message doesn't match
"UPDATE mytable SET s = 'hi' LIMIT -1;", // unsupported syntax
})
defer h.Close()
enginetest.TestUpdateErrors(t, h)
}
func TestDeleteFrom(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"DELETE FROM mytable ORDER BY i DESC LIMIT 1 OFFSET 1;", // offset is unsupported syntax
"with t (n) as (select (1) from dual) delete from mytable where i in (select n from t)",
"with recursive t (n) as (select (1) from dual union all select n + 1 from t where n < 2) delete from mytable where i in (select n from t)",
})
defer h.Close()
// We've inlined part of engineTest.TestDeleteFrom here because that method tests many queries for join deletions
// that would be tedious to write out as skips
h.Setup(setup.MydbData, setup.MytableData, setup.TabletestData)
t.Run("Delete from single table", func(t *testing.T) {
for _, tt := range queries.DeleteTests {
enginetest.RunWriteQueryTest(t, h, tt)
}
})
}
func TestDeleteFromErrors(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
// These tests are overspecified to mysql-specific errors and include some syntax we don't support, so we redefine
// the subset we're interested in checking here
h.Setup(setup.MydbData, setup.MytableData, setup.TabletestData)
deleteScripts := []queries.ScriptTest{
{
Name: "DELETE FROM error cases",
Assertions: []queries.ScriptTestAssertion{
{
Query: "DELETE FROM invalidtable WHERE x < 1;",
ExpectedErrStr: "table not found: invalidtable",
},
{
Query: "DELETE FROM mytable WHERE z = 'dne';",
ExpectedErrStr: "column \"z\" could not be found in any table in scope",
},
{
Query: "DELETE FROM mytable LIMIT -1;",
ExpectedErrStr: "LIMIT must be greater than or equal to 0",
},
{
Query: "DELETE mytable WHERE i = 1;",
ExpectedErrStr: "syntax error",
},
{
Query: "DELETE FROM (SELECT * FROM mytable) mytable WHERE i = 1;",
ExpectedErrStr: "syntax error",
},
},
},
}
for _, tt := range deleteScripts {
enginetest.TestScript(t, h, tt)
}
}
func TestSpatialDelete(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestSpatialDelete(t, h)
}
func TestSpatialScripts(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestSpatialScripts(t, h)
}
func TestSpatialIndexScripts(t *testing.T) {
t.Skip()
enginetest.TestSpatialIndexScripts(t, newDoltgresServerHarness(t))
}
func TestSpatialIndexPlans(t *testing.T) {
t.Skip()
enginetest.TestSpatialIndexPlans(t, newDoltgresServerHarness(t))
}
func TestTruncate(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestTruncate(t, h)
}
func TestConvert(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestConvertPrepared(t, h)
}
func TestScripts(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"can't create table with same name as existing view", // Doltgres needs to return a different error message
"filter pushdown through join uppercase name", // syntax error (join without on)
"issue 7958, update join uppercase table name validation", // update join syntax not supported
"Dolt issue 7957, update join matched rows", // update join syntax not supported
"update join with update trigger", // update join syntax not supported (also catches with-trigger variants by substring)
"WITH RECURSIVE\n" +
" rt (foo) AS (\n" +
" SELECT 1 as foo\n" +
" UNION ALL\n" +
" SELECT foo + 1 as foo FROM rt WHERE foo < 5\n" +
" ),\n" +
" ladder (depth, foo) AS (\n" +
" SELECT 1 as depth, NULL as foo from rt\n" +
" UNION ALL\n" +
" SELECT ladder.depth + 1 as depth, rt.foo\n" +
" FROM ladder JOIN rt WHERE ladder.foo = rt.foo\n" +
" )\n" +
"SELECT * FROM ladder;", // syntax error
"CREATE TABLE SELECT Queries", // ERROR: TableCopier only accepts CreateTable or TableNode as the destination
"db1.``.i > 0", // Multi-db Aliasing: MySQL-only empty-backtick ref
"join db2.t2 order by", // Multi-db Aliasing: MySQL implicit-cross-join (no ON)
"join db2.t2 group by", // Multi-db Aliasing: MySQL implicit-cross-join (no ON)
"join db2.t1 b order by a.i", // Multi-db Aliasing: MySQL implicit-cross-join (no ON)
// "Simple Update Join test that manipulates two tables",
// "Partial indexes are used and return the expected result",
// "Multiple indexes on the same columns in a different order",
"Ensure proper DECIMAL support (found by fuzzer)", // unsupported type: SET
// "Ensure scale is not rounded when inserting to DECIMAL type through float64",
"Show create table with various keys and constraints", // FK adds explicit ON DELETE/UPDATE RESTRICT; CHECK constraints leak backticks; timestamp(6) loses precision
"show create table with duplicate primary key", // auto-generated constraint names differ
"recreate primary key rebuilds secondary indexes", // currently no way to drop primary key in doltgres
"Handle hex number to binary conversion", // ERROR: can't convert 0x7ED0599B to decimal: exponent is not numeric
"join index lookups do not handle filters", // need a different join syntax (no ON clause not supported in postgres)
"arithmetic bit operations on int, float and decimal types", // the power operator is not yet supported
"INSERT IGNORE throws an error when json is badly formatted", // error messages don't match
"identical expressions over different windows should produce different results", // ERROR: integer: unhandled type: float64
"windows without ORDER BY should be treated as RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING", // ERROR: integer: unhandled type: float64
"division and int division operation on negative, small and big value for decimal type column of table", // numeric keys broken
"update columns with default", // broken, see repro in update_test.go
"select count(*) from t where (f in (null, cast(0.8 as float)));", // incorrect result, needs a fix
"update with left join with some missing rows", // need to translate update joins
"preserve now()", // harness error
"binary type primary key", // ERROR: blob/text column 'b' used in key specification without a key length
"varbinary primary key", // ERROR: blob/text column 'b' used in key specification without a key length
"insert into t1 (a, b) values ('1234567890', '12345')", // different error message
"insert into t2 (a, b) values ('1234567890', '12345')", // different error message
"invalid utf8 encoding strings", // need to investigate why some strings aren't giving errors, might be a harness error
"mismatched collation using hash in tuples", // ERROR: plan is not resolved because of node '*plan.Project'
"validate_password_strength and validate_password.length", // unsupported
"validate_password_strength and validate_password.number_count", // unsupported
"validate_password_strength and validate_password.mixed_case_count", // unsupported
"validate_password_strength and validate_password.special_char_count", // unsupported
"coalesce with system types", // unsupported
"histogram bucket merging error for implementor buckets", // unsupported "with recursive" syntax
"varchar primary key", // literal values longer than the key length returns incorrect results for some queries
"can't create view with same name as existing table", // different error message
})
defer h.Close()
enginetest.TestScripts(t, h)
}
func TestJoinOps(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestJoinOps(t, h, enginetest.DefaultJoinOpTests)
}
func TestJoinPlanning(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t).WithConfigureStats(true)
defer h.Close()
enginetest.TestJoinPlanning(t, h)
}
func TestJoinQueries(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestJoinQueries(t, h)
}
// TestJSONTableQueries runs the canonical test queries against a single threaded index enabled harness.
func TestJSONTableQueries(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestJSONTableQueries(t, h)
}
// TestJSONTableScripts runs the canonical test queries against a single threaded index enabled harness.
func TestJSONTableScripts(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestJSONTableScripts(t, h)
}
func TestUserAuthentication(t *testing.T) {
t.Skip("Unexpected panic, need to fix")
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestUserAuthentication(t, h)
}
func TestComplexIndexQueries(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestComplexIndexQueries(t, h)
}
func TestCreateTable(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestCreateTable(t, h)
}
func TestRowLimit(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestRowLimit(t, h)
}
func TestBranchDdl(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunBranchDdlTest(t, h)
}
func TestPkOrdinalsDDL(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestPkOrdinalsDDL(t, h)
}
func TestPkOrdinalsDML(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestPkOrdinalsDML(t, h)
}
func TestDropTable(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestDropTable(t, h)
}
func TestRenameTable(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestRenameTable(t, h)
}
func TestRenameColumn(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestRenameColumn(t, h)
}
func TestAddColumn(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestAddColumn(t, h)
}
func TestModifyColumn(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestModifyColumn(t, h)
}
func TestDropColumn(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestDropColumn(t, h)
}
func TestCreateDatabase(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestCreateDatabase(t, h)
}
func TestBlobs(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestBlobs(t, h)
}
func TestIndexes(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
defer harness.Close()
enginetest.TestIndexes(t, harness)
}
func TestIndexedExpressions(t *testing.T) {
harness := newDoltgresServerHarness(t)
defer harness.Close()
enginetest.TestIndexedExpressions(t, harness)
}
func TestIndexPrefix(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunIndexPrefixTest(t, harness)
}
func TestBigBlobs(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunBigBlobsTest(t, h)
}
func TestDropDatabase(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDropEngineTest(t, h)
}
func TestCreateForeignKeys(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestCreateForeignKeys(t, h)
}
func TestDropForeignKeys(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestDropForeignKeys(t, h)
}
func TestForeignKeys(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestForeignKeys(t, h)
}
func TestForeignKeyBranches(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunForeignKeyBranchesTest(t, h)
}
func TestFulltextIndexes(t *testing.T) {
t.Skip()
if runtime.GOOS == "windows" && os.Getenv("CI") != "" {
t.Skip("For some reason, this is flaky only on Windows CI.")
}
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestFulltextIndexes(t, h)
}
func TestCreateCheckConstraints(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestCreateCheckConstraints(t, h)
}
func TestChecksOnInsert(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestChecksOnInsert(t, h)
}
func TestChecksOnUpdate(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestChecksOnUpdate(t, h)
}
func TestDisallowedCheckConstraints(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestDisallowedCheckConstraints(t, h)
}
func TestDropCheckConstraints(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestDropCheckConstraints(t, h)
}
func TestReadOnly(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestReadOnly(t, h, false /* testStoredProcedures */)
}
func TestViews(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestViews(t, h)
}
func TestBranchViews(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunBranchViewsTest(t, h)
}
func TestVersionedViews(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunVersionedViewsTest(t, h)
}
func TestWindowFunctions(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestWindowFunctions(t, h)
}
func TestWindowRowFrames(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestWindowRowFrames(t, h)
}
func TestWindowRangeFrames(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestWindowRangeFrames(t, h)
}
func TestNamedWindows(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestNamedWindows(t, h)
}
func TestNaturalJoin(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestNaturalJoin(t, h)
}
func TestNaturalJoinEqual(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestNaturalJoinEqual(t, h)
}
func TestNaturalJoinDisjoint(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestNaturalJoinEqual(t, h)
}
func TestInnerNestedInNaturalJoins(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestInnerNestedInNaturalJoins(t, h)
}
func TestColumnDefaults(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestColumnDefaults(t, h)
}
func TestOnUpdateExprScripts(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestOnUpdateExprScripts(t, h)
}
func TestAlterTable(t *testing.T) {
t.Skip()
// This is a newly added test in GMS that dolt doesn't support yet
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{"ALTER TABLE t42 ADD COLUMN s varchar(20), drop check check1"})
defer h.Close()
enginetest.TestAlterTable(t, h)
}
func TestVariables(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunVariableTest(t, h)
}
func TestVariableErrors(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestVariableErrors(t, h)
}
func TestLoadData(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestLoadData(t, h)
}
func TestLoadDataErrors(t *testing.T) {
t.Skip()
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestLoadDataErrors(t, h)
}
func TestSelectIntoFile(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestSelectIntoFile(t, h)
}
func TestJsonScripts(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
skippedTests := []string{
"round-trip into table", // The current Dolt JSON format does not preserve decimals and unsigneds in JSON.
}
// TODO: fix this, use a skipping harness
enginetest.TestJsonScripts(t, h, skippedTests)
}
func TestTriggers(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestTriggers(t, h)
}
func TestRollbackTriggers(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestRollbackTriggers(t, h)
}
func TestStoredProcedures(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunStoredProceduresTest(t, h)
}
func TestDoltStoredProcedures(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDoltStoredProceduresTest(t, h)
}
func TestEvents(t *testing.T) {
t.Skip()
doltHarness := newDoltgresServerHarness(t)
defer doltHarness.Close()
enginetest.TestEvents(t, doltHarness)
}
func TestCallAsOf(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunCallAsOfTest(t, h)
}
func TestLargeJsonObjects(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunLargeJsonObjectsTest(t, harness)
}
func TestTransactions(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunTransactionTests(t, h, false)
}
func TestBranchTransactions(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunBranchTransactionTest(t, h)
}
func TestMultiDbTransactions(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunMultiDbTransactionsTest(t, h)
}
func TestConcurrentTransactions(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestConcurrentTransactions(t, h)
}
func TestDoltScripts(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltScriptsTest(t, harness)
}
func TestDoltTempTableScripts(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltTempTableScripts(t, harness)
}
func TestDoltRevisionDbScripts(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDoltRevisionDbScriptsTest(t, h)
}
func TestDoltDdlScripts(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltDdlScripts(t, harness)
}
func TestBrokenDdlScripts(t *testing.T) {
t.Skip()
for _, script := range denginetest.BrokenDDLScripts {
t.Skip(script.Name)
}
}
func TestDescribeTableAsOf(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestScript(t, h, denginetest.DescribeTableAsOfScriptTest)
}
func TestShowCreateTable(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
// These scripts call dolt_commit_hash_out(@Commit1, ...). Passing a
// user variable to dolt_commit_hash_out via the converter's
// current_setting() shim hits an unrelated unsupported-operator
// path. Unskip once that lands.
"Show create table as of",
"Show create table as of with FKs",
})
denginetest.RunShowCreateTableTests(t, h)
}
func TestViewsWithAsOf(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestScript(t, h, denginetest.ViewsWithAsOfScriptTest)
}
func TestDoltMerge(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"dolt_preview_merge_conflicts_summary(", // returns schema qualified table names
"CALL DOLT_MERGE with schema conflicts can be correctly resolved using dolt_conflicts_resolve when autocommit is off", // alter table
"merge conflicts prevent new branch creation", // different error message
"Drop and add primary key on two branches converges to same schema", // alter table
"insert two tables with the same name and different schema",
"dropping constraint from one branch drops from both", // alter table (also catches the no-checkout variant)
"merge with new triggers defined", // triggers
"try to merge a nullable field into a non-null column", // alter table
"merge fulltext with renamed table", // alter table
"select * from dolt_status", // table_name column includes schema name,
"dolt_merge() (3way) works with no auto increment overlap", // sequencing doesn't work globally after merge, need to decide product behavior
"dolt_merge() (3way) with a gap in an auto increment key", // sequencing doesn't work globally after merge, need to decide product behavior
"dolt_merge() with a gap in an auto increment key", // unsupported insert statements (need to call next_val, not insert NULL)
"Merge does not panic when FK is dropped and re-added on one branch and child has composite PK with mixed types", // different foreign key syntax
"three-way merge of table with vector index", // MySQL VECTOR type has no Postgres equivalent
"dolt_conflicts_resolve keeps vector index consistent with resolved rows", // MySQL VECTOR type has no Postgres equivalent
})
denginetest.RunDoltMergeTests(t, h)
}
func TestDoltRebase(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDoltRebaseTests(t, h)
}
func TestDoltRevert(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"dolt_revert() respects dolt_ignore", // ERROR: INSERT: non-Doltgres type found in destination: text
"dolt_revert() automatically resolves some conflicts", // panic: interface conversion: sql.Type is types.VarCharType, not types.StringType
"select count(*) from dolt_log;", // Doltgres creates an additional commit that Dolt doesn't have
"dolt_revert() --continue: ignored table in working set", // ERROR: ASSIGNMENT_CAST: target is of type boolean but expression is of type integer: 1
})
denginetest.RunDoltRevertTests(t, h)
}
func TestDoltAutoIncrement(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDoltAutoIncrementTests(t, h)
}
func TestDoltConflictsTableNameTable(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"dolt_preview_merge_conflicts_summary(", // returns schema qualified table names
"Provides a dolt_conflicts_id", // relies on user vars
"Updating our cols after schema change", // alter table
})
denginetest.RunDoltConflictsTableNameTableTests(t, h)
}
// tests new format behavior for keyless merges that create CVs and conflicts
func TestKeylessDoltMergeCVsAndConflicts(t *testing.T) {
h := newDoltgresServerHarness(t)
denginetest.RunKeylessDoltMergeCVsAndConflictsTests(t, h)
}
// eventually this will be part of TestDoltMerge
func TestDoltMergeArtifacts(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"conflicts of different schemas can't coexist", // alter table
"violations with an older commit hash are overwritten if the value is the same", // nothing to commit?
"regression test for bad column ordering in schema", // enum not supported in test harness
"schema conflicts return an error when autocommit is enabled", // problems detecting autocommit for business logic
"merge error lists all constraint violations when table has multiple violations",
})
denginetest.RunDoltMergeArtifacts(t, h)
}
func TestDoltReset(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"select * from dolt_status", // table_name column includes schema name
"SELECT pk, v FROM t AS OF STAGED ORDER BY pk", // AS OF STAGED requires quoting in Postgres
"SELECT pk FROM t AS OF STAGED ORDER BY pk", // AS OF STAGED requires quoting in Postgres
})
denginetest.RunDoltResetTest(t, h)
}
func TestDoltGC(t *testing.T) {
t.Skip()
for _, script := range denginetest.DoltGC {
func() {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestScript(t, h, script)
}()
}
}
func TestDoltCheckout(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"branch last checked out is deleted",
"Using non-existent refs",
"read-only databases", // read-only not yet implemented in harness
"Checkout tables from commit",
"dolt_checkout with tracking branch and table with same name", // UseLocalFileSystem did not create remote dir
})
denginetest.RunDoltCheckoutTests(t, h)
}
func TestDoltBranch(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"Create branch from startpoint", // missing SET @var syntax
"Join same table at two commits", // implicit cross-joins (no ON clause) unsupported in postgres
})
denginetest.RunDoltBranchTests(t, h)
}
func TestDoltTag(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
// dolt's initialization is different which results in a different user name for the tagger,
// should fix the harness to match
"SELECT tag_name, IF(CHAR_LENGTH(tag_hash) < 0, NULL, 'not null'), tagger, email, IF(date IS NULL, NULL, 'not null'), message from dolt_tags",
})
denginetest.RunDoltTagTests(t, h)
}
func TestDoltRemote(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDoltRemoteTests(t, h)
}
func TestDoltUndrop(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDoltUndropTests(t, h)
}
func TestBrokenSystemTableQueries(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.RunQueryTests(t, h, denginetest.BrokenSystemTableQueries)
}
func TestHistorySystemTable(t *testing.T) {
harness := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"explain", // not supported
"select message from dolt_log", // doltgres setup has extra commits
"dolt_history table with enums", // enums
"can sort by dolt_log.commit", // more commits
}).WithParallelism(2)
denginetest.RunHistorySystemTableTests(t, harness)
}
func TestUnscopedDiffSystemTable(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunUnscopedDiffSystemTableTests(t, h)
}
func TestColumnDiffSystemTable(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunColumnDiffSystemTableTests(t, h)
}
func TestStatBranchTests(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunStatBranchTests(t, harness)
}
func TestDiffTableFunction(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDiffTableFunctionTests(t, harness)
}
func TestDiffStatTableFunction(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDiffStatTableFunctionTests(t, harness)
}
func TestDiffSummaryTableFunction(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDiffSummaryTableFunctionTests(t, harness)
}
func TestPatchTableFunction(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltPatchTableFunctionTests(t, harness)
}
func TestLogTableFunction(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunLogTableFunctionTests(t, harness)
}
func TestDoltReflog(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltReflogTests(t, harness)
}
func TestCommitDiffSystemTable(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunCommitDiffSystemTableTests(t, harness)
}
func TestDiffSystemTable(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunDoltDiffSystemTableTests(t, h)
}
func TestSchemaDiffTableFunction(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunSchemaDiffTableFunctionTests(t, harness)
}
func TestDoltDatabaseCollationDiffs(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltDatabaseCollationDiffsTests(t, harness)
}
func TestQueryDiff(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunQueryDiffTests(t, harness)
}
func TestSystemTableIndexes(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunSystemTableIndexesTests(t, harness)
}
func TestSystemTableFunctionIndexes(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunSystemTableFunctionIndexesTests(t, harness)
}
func TestReadOnlyDatabases(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestReadOnlyDatabases(t, h)
}
func TestAddDropPks(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestAddDropPks(t, h)
}
func TestAddAutoIncrementColumn(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunAddAutoIncrementColumnTests(t, h)
}
func TestNullRanges(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestNullRanges(t, h)
}
func TestPersist(t *testing.T) {
t.Skip()
ctx := context.Background()
harness := newDoltgresServerHarness(t)
defer harness.Close()
dEnv := dtestutils.CreateTestEnv()
defer dEnv.DoltDB(ctx).Close()
localConf, ok := dEnv.Config.GetConfig(env.LocalConfig)
require.True(t, ok)
globals := config.NewPrefixConfig(localConf, env.SqlServerGlobalsPrefix)
newPersistableSession := func(ctx *sql.Context) sql.PersistableSession {
session := ctx.Session.(*dsess.DoltSession).WithGlobals(globals)
err := session.RemoveAllPersistedGlobals()
require.NoError(t, err)
return session
}
enginetest.TestPersist(t, harness, newPersistableSession)
}
func TestTypesOverWire(t *testing.T) {
t.Skip("Port equivalent test from Dolt")
}
func TestDoltCherryPick(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltCherryPickTests(t, harness)
}
func TestDoltCommit(t *testing.T) {
harness := newDoltgresServerHarness(t).WithSkippedQueries([]string{
// These tests set @@autocommit, which we can't translate accurately yet
"CALL DOLT_COMMIT('-amend') works to update commit message",
"CALL DOLT_COMMIT('-amend') works to add changes to a commit",
"CALL DOLT_COMMIT('-amend') works to remove changes from a commit",
"CALL DOLT_COMMIT('-amend') works to update a merge commit",
"CALL DOLT_COMMIT('--amend') works on initial commit",
"DOLT_COMMIT respects foreign_key_checks=0",
})
denginetest.RunDoltCommitTests(t, harness)
}
func TestStatsHistograms(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunStatsHistogramTests(t, h)
}
// TestStatsStorage force a provider reload in-between setup and assertions that
// forces a round trip of the statistics table before inspecting values.
func TestStatsStorage(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunStatsStorageTests(t, h)
}
func TestJoinStats(t *testing.T) {
h := newDoltgresServerHarness(t)
denginetest.RunJoinStatsTests(t, h)
}
func TestStatisticIndexes(t *testing.T) {
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestStatisticIndexFilters(t, h)
}
func TestCharsetCollationEngine(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestCharsetCollationEngine(t, h)
}
func TestCharsetCollationWire(t *testing.T) {
t.Skip("port test from Dolt")
}
func TestDatabaseCollationWire(t *testing.T) {
t.Skip("port test from Dolt")
}
func TestAddDropPrimaryKeys(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunAddDropPrimaryKeysTests(t, harness)
}
func TestDoltVerifyConstraints(t *testing.T) {
t.Skip()
harness := newDoltgresServerHarness(t)
denginetest.RunDoltVerifyConstraintsTests(t, harness)
}
func TestDoltStorageFormat(t *testing.T) {
h := newDoltgresServerHarness(t)
denginetest.RunDoltStorageFormatTests(t, h)
}
func TestThreeWayMergeWithSchemaChangeScripts(t *testing.T) {
t.Skip()
h := newDoltgresServerHarness(t)
denginetest.RunThreeWayMergeWithSchemaChangeScripts(t, h)
}
// If CREATE DATABASE has an error within the DatabaseProvider, it should not
// leave behind intermediate filesystem state.
func TestCreateDatabaseErrorCleansUp(t *testing.T) {
t.Skip("port test from Dolt")
}
// TestStatsAutoRefreshConcurrency tests some common concurrent patterns that stats
// refresh is subject to -- namely reading/writing the stats objects in (1) DML statements
// (2) auto refresh threads, and (3) manual ANALYZE statements.
// todo: the dolt_stat functions should be concurrency tested
func TestStatsAutoRefreshConcurrency(t *testing.T) {
t.Skip("port test from Dolt")
}
func TestAdaptiveEncoding(t *testing.T) {
// The test runs end-to-end, but most subtests currently fail because:
// - bytea/text round-trips through the harness lose data for BLOB columns
// - the converter does not yet translate MySQL prefix indexes (`col(N)`),
// LOAD_FILE(), or INSERT of text literals into bytea columns
// Unskip once those gaps are filled.
t.Skip("AdaptiveEncoding runs but fails on bytea round-trip / MySQL-only queries; see comment")
adaptiveEncoding := typeinfo.UseAdaptiveEncoding
defer func() { typeinfo.UseAdaptiveEncoding = adaptiveEncoding }()
typeinfo.UseAdaptiveEncoding = true
denginetest.RunTestAdaptiveEncoding(t, newDoltgresServerHarness(t), denginetest.AdaptiveEncodingTestType_Blob, denginetest.AdaptiveEncodingTestPurpose_Representation)
denginetest.RunTestAdaptiveEncoding(t, newDoltgresServerHarness(t), denginetest.AdaptiveEncodingTestType_Blob, denginetest.AdaptiveEncodingTestPurpose_Correctness)
denginetest.RunTestAdaptiveEncoding(t, newDoltgresServerHarness(t), denginetest.AdaptiveEncodingTestType_Text, denginetest.AdaptiveEncodingTestPurpose_Representation)
denginetest.RunTestAdaptiveEncoding(t, newDoltgresServerHarness(t), denginetest.AdaptiveEncodingTestType_Text, denginetest.AdaptiveEncodingTestPurpose_Correctness)
denginetest.RunAdaptiveEncodingScripts(t, newDoltgresServerHarness(t))
}
func TestSchemaOverridesWithAdaptiveEncoding(t *testing.T) {
// Runs end-to-end but fails on @@dolt_override_schema (user-variable scope)
// and the MySQL DESCRIBE statement. Unskip once those land.
t.Skip("SchemaOverrides runs but fails on @@dolt_override_schema / DESCRIBE; see comment")
adaptiveEncoding := typeinfo.UseAdaptiveEncoding
defer func() { typeinfo.UseAdaptiveEncoding = adaptiveEncoding }()
typeinfo.UseAdaptiveEncoding = true
harness := newDoltgresServerHarness(t)
denginetest.RunSchemaOverridesTest(t, harness)
}
func TestJsonAdaptiveEncoding(t *testing.T) {
adaptiveEncoding := typeinfo.UseAdaptiveEncoding
defer func() { typeinfo.UseAdaptiveEncoding = adaptiveEncoding }()
typeinfo.UseAdaptiveEncoding = true
harness := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"json_extract(", // MySQL-specific; postgres uses -> / jsonb_extract_path_text
})
denginetest.RunJsonAdaptiveEncodingTests(t, harness)
}
func TestBackupsSystemTable(t *testing.T) {
t.Skip("port test from Dolt")
}
func TestBranchActivity(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunBranchActivityTests(t, harness)
}
func TestBranchStatusTableFunction(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunBranchStatusTableFunctionTests(t, harness)
}
func TestConcurrentCreateDatabaseIfNotExists(t *testing.T) {
t.Skip("port test from Dolt")
}
func TestDoltBranchesSystemTable(t *testing.T) {
t.Skip("port test from Dolt")
h := newDoltgresServerHarness(t)
denginetest.RunDoltBranchesSystemTableTests(t, h)
}
func TestDoltCommitVerificationScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunDoltCommitVerificationScripts(t, harness)
}
func TestDoltDTableScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunDoltDTableScriptsTest(t, harness)
}
func TestDoltForeignKeyTests(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunDoltForeignKeyTests(t, harness)
}
func TestDoltHelpSystemTable(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
defer harness.Close()
denginetest.RunDoltHelpSystemTableTests(t, harness)
}
func TestDoltPreviewMergeConflicts(t *testing.T) {
t.Skip("port test from Dolt")
h := newDoltgresServerHarness(t)
denginetest.RunDoltPreviewMergeConflictsTests(t, h)
}
func TestDoltQueryCatalogSystemTable(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
defer harness.Close()
denginetest.RunDoltQueryCatalogTests(t, harness)
}
func TestDoltRm(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
defer harness.Close()
denginetest.RunDoltRmTests(t, harness)
}
func TestDoltStash(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
defer harness.Close()
denginetest.RunDoltStashSystemTableTests(t, harness)
}
func TestDoltTestsSystemTable(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
defer harness.Close()
denginetest.RunDoltTestsTableTests(t, harness)
}
func TestDoltUserPrivileges(t *testing.T) {
t.Skip("MySQL-specific user privilege tests, not applicable to doltgresql")
}
func TestDoltWorkspace(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunDoltWorkspaceTests(t, harness)
}
func TestDriverExecution(t *testing.T) {
t.Skip("port test from Dolt - uses dolt_backup which is not yet supported")
}
func TestJsonDiffTableFunction(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunJsonDiffTableFunctionTests(t, harness)
}
func TestJsonValueScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunJsonValueScriptsTest(t, harness)
}
func TestLargeGeometryScripts(t *testing.T) {
t.Skip("doltgresql does not support spatial types")
}
func TestLegacyCreateTableScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyCreateTableScripts(t, harness)
}
func TestLegacyDeleteScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyDeleteScripts(t, harness)
}
func TestLegacyDropTableScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyDropTableScripts(t, harness)
}
func TestLegacyIndexScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyIndexScripts(t, harness)
}
func TestLegacyInsertScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyInsertScripts(t, harness)
}
func TestLegacyJoinScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyJoinScripts(t, harness)
}
func TestLegacyReplaceScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyReplaceScripts(t, harness)
}
func TestLegacySelectScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacySelectScripts(t, harness)
}
func TestLegacyUpdateScripts(t *testing.T) {
t.Skip("port test from Dolt")
harness := newDoltgresServerHarness(t)
denginetest.RunLegacyUpdateScripts(t, harness)
}
func TestNonlocalTable(t *testing.T) {
t.Skip("port test from Dolt")
h := newDoltgresServerHarness(t)
denginetest.RunNonlocalTableTests(t, h)
}
func TestNumericErrorScripts(t *testing.T) {
t.Skip("port test from Dolt")
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestNumericErrorScripts(t, h)
}
func TestSingleMergeScript(t *testing.T) {
t.Skip("debug harness for a single merge script")
}
func TestSingleTransactionScript(t *testing.T) {
t.Skip("debug harness for a single transaction script")
}
func TestTimeQueries(t *testing.T) {
t.Skip("port test from Dolt")
h := newDoltgresServerHarness(t)
defer h.Close()
enginetest.TestTimeQueries(t, h)
}
func TestUpdateIgnore(t *testing.T) {
h := newDoltgresServerHarness(t).WithSkippedQueries([]string{
"UPDATE IGNORE with primary keys and indexes", // ignore semantics are different
"UPDATE IGNORE with type conversions", // postgres strict typing rejects MySQL coercions
})
defer h.Close()
enginetest.TestUpdateIgnore(t, h)
}
func TestUserPrivileges(t *testing.T) {
t.Skip("MySQL-specific user privilege tests, not applicable to doltgresql")
}
func TestVectorFunctions(t *testing.T) {
t.Skip("doltgresql does not yet support vector types")
}
func TestVectorIndexes(t *testing.T) {
t.Skip("doltgresql does not yet support vector types")
}
func TestVectorType(t *testing.T) {
t.Skip("doltgresql does not yet support vector types")
}