Implements Parser::DDLStmt.
Definition at line 6743 of file ParserNode.cpp.
References Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), query_state::QueryState::create(), AccessPrivileges::CREATE_VIEW, DEFAULT_FRAGMENT_ROWS, DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_ROWS, DEFAULT_PAGE_SIZE, TableDescriptor::fragmenter, TableDescriptor::fragPageSize, TableDescriptor::fragType, g_enable_watchdog, Catalog_Namespace::SessionInfo::get_currentUser(), Catalog_Namespace::SessionInfo::getCatalog(), legacylockmgr::getExecuteWriteLock(), if_not_exists_, Fragmenter_Namespace::INSERT_ORDER, lockmgr::instance(), TableDescriptor::isView, TableDescriptor::maxChunkSize, TableDescriptor::maxFragRows, TableDescriptor::maxRows, TableDescriptor::nColumns, pg_shim(), select_query_, STDLOG, TableDescriptor::tableName, TableDescriptor::userId, Catalog_Namespace::UserMetadata::userId, view_name_, ViewDBObjectType, and TableDescriptor::viewSQL.
Referenced by heavydb.cursor.Cursor::executemany().
6745 if (read_only_mode) {
6746 throw std::runtime_error(
"CREATE VIEW invalid in read only mode.");
6748 auto session_copy = session;
6749 auto session_ptr = std::shared_ptr<Catalog_Namespace::SessionInfo>(
6750 &session_copy, boost::null_deleter());
6752 auto stdlog =
STDLOG(query_state);
6760 throw std::runtime_error(
"View " +
view_name_ +
6761 " will not be created. User has no create view privileges.");
6765 auto calcite_mgr = catalog.getCalciteMgr();
6768 const auto calciteQueryParsingOption =
6769 calcite_mgr->getCalciteQueryParsingOption(
true,
false,
true,
false);
6770 const auto calciteOptimizationOption = calcite_mgr->getCalciteOptimizationOption(
6772 calcite_mgr->process(query_state->createQueryStateProxy(),
6774 calciteQueryParsingOption,
6775 calciteOptimizationOption);
6785 td.
viewSQL = query_after_shim;
6794 catalog.createTable(td, {}, {},
true);
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
std::string pg_shim(std::string const &query)
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