PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/heapam.h"
#include "access/reloptions.h"
#include "access/tableam.h"
#include "access/xact.h"
#include "catalog/namespace.h"
#include "catalog/toasting.h"
#include "commands/createas.h"
#include "commands/matview.h"
#include "commands/prepare.h"
#include "commands/tablecmds.h"
#include "commands/view.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "rewrite/rewriteHandler.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/rls.h"
#include "utils/snapmgr.h"
Go to the source code of this file.
Data Structures | |
struct | DR_intorel |
Functions | |
static ObjectAddress | create_ctas_internal (List *attrList, IntoClause *into) |
static ObjectAddress | create_ctas_nodata (List *tlist, IntoClause *into) |
static void | intorel_startup (DestReceiver *self, int operation, TupleDesc typeinfo) |
static bool | intorel_receive (TupleTableSlot *slot, DestReceiver *self) |
static void | intorel_shutdown (DestReceiver *self) |
static void | intorel_destroy (DestReceiver *self) |
ObjectAddress | ExecCreateTableAs (ParseState *pstate, CreateTableAsStmt *stmt, ParamListInfo params, QueryEnvironment *queryEnv, QueryCompletion *qc) |
int | GetIntoRelEFlags (IntoClause *intoClause) |
bool | CreateTableAsRelExists (CreateTableAsStmt *ctas) |
DestReceiver * | CreateIntoRelDestReceiver (IntoClause *intoClause) |
|
static |
Definition at line 80 of file createas.c.
References CreateStmt::accessMethod, IntoClause::accessMethod, CommandCounterIncrement(), CreateStmt::constraints, copyObject, DefineRelation(), HEAP_RELOPT_NAMESPACES, heap_reloptions(), CreateStmt::if_not_exists, CreateStmt::inhRelations, InvalidOid, makeNode, NewRelationCreateToastTable(), NIL, ObjectAddress::objectId, CreateStmt::ofTypename, CreateStmt::oncommit, IntoClause::onCommit, CreateStmt::options, IntoClause::options, IntoClause::rel, CreateStmt::relation, StoreViewQuery(), CreateStmt::tableElts, CreateStmt::tablespacename, IntoClause::tableSpaceName, and transformRelOptions().
Referenced by create_ctas_nodata(), and intorel_startup().
|
static |
Definition at line 153 of file createas.c.
References ColumnDef::collOid, ColumnDef::colname, IntoClause::colNames, create_ctas_internal(), ereport, errcode(), errhint(), errmsg(), ERROR, TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), format_type_be(), lappend(), lfirst, list_head(), lnext(), makeColumnDef(), NIL, OidIsValid, strVal, type_is_collatable(), ColumnDef::typeName, and TypeName::typeOid.
Referenced by ExecCreateTableAs().
DestReceiver* CreateIntoRelDestReceiver | ( | IntoClause * | intoClause | ) |
Definition at line 430 of file createas.c.
References DestIntoRel, intorel_destroy(), intorel_receive(), intorel_shutdown(), intorel_startup(), and palloc0().
Referenced by CreateDestReceiver(), ExecCreateTableAs(), and ExplainOnePlan().
bool CreateTableAsRelExists | ( | CreateTableAsStmt * | ctas | ) |
Definition at line 383 of file createas.c.
References checkMembershipInCurrentExtension(), ereport, errcode(), errmsg(), ERROR, get_relname_relid(), CreateTableAsStmt::if_not_exists, CreateTableAsStmt::into, NOTICE, nspid, ObjectAddressSet, OidIsValid, RangeVarGetCreationNamespace(), IntoClause::rel, and RangeVar::relname.
Referenced by ExecCreateTableAs(), and ExplainOneUtility().
ObjectAddress ExecCreateTableAs | ( | ParseState * | pstate, |
CreateTableAsStmt * | stmt, | ||
ParamListInfo | params, | ||
QueryEnvironment * | queryEnv, | ||
QueryCompletion * | qc | ||
) |
Definition at line 221 of file createas.c.
References Assert, castNode, CMD_SELECT, CMD_UTILITY, Query::commandType, create_ctas_nodata(), CreateIntoRelDestReceiver(), CreateQueryDesc(), CreateTableAsRelExists(), CURSOR_OPT_PARALLEL_OK, generate_unaccent_rules::dest, elog, ERROR, EState::es_processed, QueryDesc::estate, ExecuteQuery(), ExecutorEnd(), ExecutorFinish(), ExecutorRun(), ExecutorStart(), ForwardScanDirection, FreeQueryDesc(), GetActiveSnapshot(), GetIntoRelEFlags(), InvalidObjectAddress, InvalidSnapshot, IsA, linitial_node, list_length(), ObjectAddress::objectId, ParseState::p_sourcetext, pg_plan_query(), plan, PopActiveSnapshot(), PushCopiedSnapshot(), QueryRewrite(), RefreshMatViewByOid(), SetQueryCompletion(), IntoClause::skipData, stmt, Query::targetList, UpdateActiveSnapshotCommandId(), and Query::utilityStmt.
Referenced by ProcessUtilitySlow().
int GetIntoRelEFlags | ( | IntoClause * | intoClause | ) |
Definition at line 365 of file createas.c.
References EXEC_FLAG_WITH_NO_DATA, and IntoClause::skipData.
Referenced by ExecCreateTableAs(), ExecuteQuery(), and ExplainOnePlan().
|
static |
Definition at line 624 of file createas.c.
References pfree().
Referenced by CreateIntoRelDestReceiver().
|
static |
Definition at line 573 of file createas.c.
References DR_intorel::bistate, DR_intorel::into, DR_intorel::output_cid, DR_intorel::rel, IntoClause::skipData, table_tuple_insert(), and DR_intorel::ti_options.
Referenced by CreateIntoRelDestReceiver().
|
static |
Definition at line 604 of file createas.c.
References DR_intorel::bistate, FreeBulkInsertState(), DR_intorel::into, NoLock, DR_intorel::rel, IntoClause::skipData, table_close(), table_finish_bulk_insert(), and DR_intorel::ti_options.
Referenced by CreateIntoRelDestReceiver().
|
static |
Definition at line 449 of file createas.c.
References AccessExclusiveLock, Assert, attnum, DR_intorel::bistate, check_enable_rls(), ColumnDef::collOid, ColumnDef::colname, IntoClause::colNames, create_ctas_internal(), ereport, errcode(), errhint(), errmsg(), ERROR, format_type_be(), GetBulkInsertState(), GetCurrentCommandId(), DR_intorel::into, InvalidBlockNumber, InvalidOid, lappend(), lfirst, list_head(), lnext(), makeColumnDef(), NameStr, TupleDescData::natts, NIL, ObjectAddress::objectId, OidIsValid, DR_intorel::output_cid, DR_intorel::rel, DR_intorel::reladdr, RelationGetTargetBlock, RLS_ENABLED, SetMatViewPopulatedState(), IntoClause::skipData, strVal, TABLE_INSERT_SKIP_FSM, table_open(), DR_intorel::ti_options, TupleDescAttr, type_is_collatable(), ColumnDef::typeName, and TypeName::typeOid.
Referenced by CreateIntoRelDestReceiver().