storage/sql: rework of the original MySQL PR

This commit is contained in:
Nandor Kracser
2019-07-12 16:29:46 +02:00
parent e53bdfabb9
commit a572ad8fec
40 changed files with 6983 additions and 74 deletions

View File

@@ -91,20 +91,16 @@ var (
{matchLiteral("bytea"), "blob"},
{matchLiteral("timestamptz"), "datetime(3)"},
// MySQL doesn't support indicies on text fields w/o
// specifying key length. Use varchar instead (768 is
// the max key length for InnoDB with 4k pages).
{matchLiteral("text"), "varchar(768)"},
// specifying key length. Use varchar instead (767 byte
// is the max key length for InnoDB with 4k pages).
// For compound indexes (with two keys) even less.
{matchLiteral("text"), "varchar(384)"},
// Quote keywords and reserved words used as identifiers.
{regexp.MustCompile(`\b(keys)\b`), "`$1`"},
// Change default timestamp to fit datetime.
{regexp.MustCompile(`0001-01-01 00:00:00 UTC`), "1000-01-01 00:00:00"},
},
}
// Not tested.
flavorCockroach = flavor{
executeTx: crdb.ExecuteTx,
}
)
func (f flavor) translate(query string) string {