Skip to content

Commit 83fadd4

Browse files
committed
Check earlier that the database has a schema mentioned in the config
1 parent 91ddbb9 commit 83fadd4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/flex-table.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,6 @@ void table_connection_t::start(bool append)
253253
{
254254
assert(m_db_connection);
255255

256-
if (!has_schema(table().schema())) {
257-
throw fmt_error("Schema '{0}' not available."
258-
" Use 'CREATE SCHEMA \"{0}\";' to create it.",
259-
table().schema());
260-
}
261-
262256
for (auto const &ts :
263257
{table().data_tablespace(), table().index_tablespace()}) {
264258
if (!has_tablespace(ts)) {

src/output-flex.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,11 @@ flex_table_t &output_flex_t::create_flex_table()
455455
if (lua_isstring(lua_state(), -1)) {
456456
std::string const schema = lua_tostring(lua_state(), -1);
457457
check_identifier(schema, "schema field");
458+
if (!has_schema(schema)) {
459+
throw fmt_error("Schema '{0}' not available."
460+
" Use 'CREATE SCHEMA \"{0}\";' to create it.",
461+
schema);
462+
}
458463
new_table.set_schema(schema);
459464
}
460465
lua_pop(lua_state(), 1);

0 commit comments

Comments
 (0)