6425 if (read_only_mode) {
6426 throw std::runtime_error(
"CREATE VIEW invalid in read only mode.");
6428 auto session_copy = session;
6429 auto session_ptr = std::shared_ptr<Catalog_Namespace::SessionInfo>(
6430 &session_copy, boost::null_deleter());
6432 auto stdlog =
STDLOG(query_state);
6440 throw std::runtime_error(
"View " +
view_name_ +
6441 " will not be created. User has no create view privileges.");
6445 auto calcite_mgr = catalog.getCalciteMgr();
6448 const auto calciteQueryParsingOption =
6449 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
6450 const auto calciteOptimizationOption = calcite_mgr->getCalciteOptimizationOption(
6452 calcite_mgr->process(query_state->createQueryStateProxy(),
6454 calciteQueryParsingOption,
6455 calciteOptimizationOption);
6458 const auto execute_write_lock =
6468 td.viewSQL = query_after_shim;
6469 td.fragmenter =
nullptr;
6477 catalog.createTable(td, {}, {},
true);
6481 SysCatalog::instance().createDBObject(
static std::shared_ptr< WrapperType< MutexType > > getMutex(const LockType lockType, const KeyType &key)
static std::shared_ptr< QueryState > create(ARGS &&...args)
#define DEFAULT_MAX_CHUNK_SIZE
std::unique_lock< T > unique_lock
std::string select_query_
#define DEFAULT_PAGE_SIZE
Catalog & getCatalog() const
#define DEFAULT_FRAGMENT_ROWS
static const AccessPrivileges CREATE_VIEW
bool checkDBAccessPrivileges(const DBObjectType &permissionType, const AccessPrivileges &privs, const std::string &objectName="") const
const UserMetadata & get_currentUser() const
std::string pg_shim(const std::string &query)