6348 if (read_only_mode) {
6349 throw std::runtime_error(
"CREATE VIEW invalid in read only mode.");
6351 auto session_copy = session;
6352 auto session_ptr = std::shared_ptr<Catalog_Namespace::SessionInfo>(
6353 &session_copy, boost::null_deleter());
6355 auto stdlog =
STDLOG(query_state);
6363 throw std::runtime_error(
"View " +
view_name_ +
6364 " will not be created. User has no create view privileges.");
6368 auto calcite_mgr = catalog.getCalciteMgr();
6371 const auto calciteQueryParsingOption =
6372 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true);
6373 const auto calciteOptimizationOption =
6375 calcite_mgr->process(query_state->createQueryStateProxy(),
6377 calciteQueryParsingOption,
6378 calciteOptimizationOption);
6381 const auto execute_write_lock =
6391 td.viewSQL = query_after_shim;
6392 td.fragmenter =
nullptr;
6400 catalog.createTable(td, {}, {},
true);
6404 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)