"extract merge w/ foreign key joins using the binary operator =="
"extract merge w/ syntax as X[Y, on=.(a, b)]"
"extract merge w/ (non-equi) joins using binary operators >=, <="
"extract merge w/ (non-equi) joins using binary operators >, <"
"extract self-merge withs w/ half-named character"
"extract anti-join works w/ character non-equi join"
"extract anti-join works w/ call non-equi join"
"extract anti-join works w/ char-call non-equi join"

# When the information schema is "bare bones" or doesn't include the
# 'referential_constraints' view, then merge should work like an unkeyed
test_that("merge works on shared column (ArtistId)", {
test_that("merge fails when relational data not available", {
# non-empty character vectors of column names are required
# A non-empty vector of column names for `by` is required.
# A relational merge (merge on foreign keys) should just return x since
DBI::dbExecute(chinook, DBI::SQL("SET threads TO 1;"))
# Relational merge (1) finds the internal name of each foreign key column
# in the dbi.table's fields attribute, then (2) finds the first column in the
# dbi.table that matches each internal name exactly. When all columns are found,
# then they are used at the default 'by'.
g <- Genre[, .(gid = GenreId, Genre.Name = Name)]
by.x = "GenreId", by.y = "gid", sort = FALSE)
# Merge should fail when a column in the foreign key constraint is
test_that("relational merge fails when column missing", {
# a non-empty character vector of column names is required for 'by'
setnames(y, names(y), paste(i, names(y), sep = "."))
track <- merge(track, y, by.x = paste0(i, "Id"), by.y = names(y)[[1L]],
expect_true(all.equal(as.data.table(x), track, ignore.row.order = TRUE))
test_that("relational merge works with recursive = TRUE", {
expect_s3_class(x <- merge(Track, recursive = TRUE), "dbi.table")
setnames(y, names(y), paste("Artist", names(y), sep = "."))

"merge works on shared column (ArtistId)"
"merge fails when relational data not available"
"relational merge fails when column missing"
"relational merge works with recursive = TRUE"