diff --git a/backends/postgres/src/postgres_connection.cpp b/backends/postgres/src/postgres_connection.cpp index 4054f19..eb50d23 100644 --- a/backends/postgres/src/postgres_connection.cpp +++ b/backends/postgres/src/postgres_connection.cpp @@ -134,7 +134,13 @@ sql::record postgres_connection::describe(const std::string &table) bool postgres_connection::exists(const std::string &table_name) { - return false; + std::string stmt("SELECT 1 FROM information_schema.tables WHERE table_schema = 'public' AND table_name = '" + table_name + "'"); + + PGresult *res = PQexec(conn_, stmt.c_str()); + + throw_postgres_error(res, conn_, "postgres", stmt); + + return sql::to_long_long(PQcmdTuples(res)) == 1; } }