Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --use-existing-data mode broken by DELETE tests #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Tests/ExecuteTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4310,6 +4310,15 @@ TEST(Select, GeoSpatial) {

namespace {

void set_deleted_column() {
auto& cat = g_session->get_catalog();
const auto td = cat.getMetadataForTable("test_inner_deleted");
CHECK(td);
const auto cd = cat.getMetadataForColumn(td->tableId, "deleted");
CHECK(cd);
cat.setDeletedColumn(td, cd);
}

int create_and_populate_tables() {
try {
const std::string drop_old_test{"DROP TABLE IF EXISTS test_inner;"};
Expand Down Expand Up @@ -4342,12 +4351,7 @@ int create_and_populate_tables() {
const auto create_test_inner_deleted =
build_create_table_statement(columns_definition, "test_inner_deleted", {"", 0}, {}, 2);
run_ddl_statement(create_test_inner_deleted);
auto& cat = g_session->get_catalog();
const auto td = cat.getMetadataForTable("test_inner_deleted");
CHECK(td);
const auto cd = cat.getMetadataForColumn(td->tableId, "deleted");
CHECK(cd);
cat.setDeletedColumn(td, cd);
set_deleted_column();
g_sqlite_comparator.query("CREATE TABLE test_inner_deleted(x int not null, y int, str text);");
} catch (...) {
LOG(ERROR) << "Failed to (re-)create table 'test_inner_deleted'";
Expand Down Expand Up @@ -4854,6 +4858,7 @@ int main(int argc, char** argv) {
const bool use_existing_data = vm.count("use-existing-data");
int err{0};
if (use_existing_data) {
set_deleted_column();
testing::GTEST_FLAG(filter) = "Select*";
} else {
err = create_and_populate_tables();
Expand Down