6724 if (read_only_mode) {
6725 throw std::runtime_error(
"CREATE VIEW invalid in read only mode.");
6727 auto session_copy = session;
6728 auto session_ptr = std::shared_ptr<Catalog_Namespace::SessionInfo>(
6729 &session_copy, boost::null_deleter());
6731 auto stdlog =
STDLOG(query_state);
6739 throw std::runtime_error(
"View " +
view_name_ +
6740 " will not be created. User has no create view privileges.");
6744 auto calcite_mgr = catalog.getCalciteMgr();
6747 const auto calciteQueryParsingOption =
6748 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true,
false);
6749 const auto calciteOptimizationOption = calcite_mgr->getCalciteOptimizationOption(
6751 calcite_mgr->process(query_state->createQueryStateProxy(),
6753 calciteQueryParsingOption,
6754 calciteOptimizationOption);
6764 td.
viewSQL = query_after_shim;
6773 catalog.createTable(td, {}, {},
true);
6777 SysCatalog::instance().createDBObject(
static std::shared_ptr< QueryState > create(ARGS &&...args)
#define DEFAULT_MAX_CHUNK_SIZE
std::string select_query_
std::shared_ptr< Fragmenter_Namespace::AbstractFragmenter > fragmenter
#define DEFAULT_PAGE_SIZE
Catalog & getCatalog() const
#define DEFAULT_FRAGMENT_ROWS
Fragmenter_Namespace::FragmenterType fragType
static const AccessPrivileges CREATE_VIEW
auto getExecuteWriteLock()
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)