Treat all NULL values differently in UNIQUE indexes

SQL standard can be interpreted differently:
either NULL values are all unique (SQLite, PostgreSQL, ... and now Genji)
or they are considered equal (SQL Server, ...).
This commit is contained in:
Asdine El Hrychy
2021-12-13 09:32:22 +05:30
parent 1da209b2ac
commit 2d4df658e4
7 changed files with 87 additions and 38 deletions

View File

@@ -23,29 +23,8 @@ var doc types.Document = func() types.Document {
var envWithDoc = environment.New(doc)
var envWithDocAndKey *environment.Environment = func() *environment.Environment {
env := environment.New(doc)
env.Set(environment.TableKey, types.NewTextValue("string"))
env.Set(environment.DocPKKey, types.NewBlobValue([]byte("foo")))
return env
}()
var nullLiteral = types.NewNullValue()
func testExpr(t testing.TB, exprStr string, env *environment.Environment, want types.Value, fails bool) {
t.Helper()
e, err := parser.NewParser(strings.NewReader(exprStr)).ParseExpr()
assert.NoError(t, err)
res, err := e.Eval(env)
if fails {
assert.Error(t, err)
} else {
assert.NoError(t, err)
require.Equal(t, want, res)
}
}
func TestString(t *testing.T) {
var operands = []string{
`10.4`,