add materialized view feature to opengauss

This commit is contained in:
sqyyeah
2020-08-17 11:48:18 +08:00
parent 3eade03f9c
commit d5337ceca7
120 changed files with 3796 additions and 823 deletions

View File

@ -71,6 +71,7 @@ extern Node* makeTidConst(ItemPointer item);
extern FuncCall* makeFuncCall(List* funcname, List* args, int location);
extern Param* makeParam(
ParamKind paramkind, int paramid, Oid paramtype, int32 paramtypmod, Oid paramcollid, int location);
extern ColumnDef* makeColumnDef(const char* colname, Oid typeOid, int32 typmod, Oid collOid);
extern IndexInfo* makeIndexInfo(int numattrs, List *expressions, List *predicates,
bool unique, bool isready, bool concurrent);
#endif /* MAKEFUNC_H */

View File

@ -452,6 +452,7 @@ typedef enum NodeTag {
T_DropDirectoryStmt,
T_CreateRlsPolicyStmt,
T_AlterRlsPolicyStmt,
T_RefreshMatViewStmt,
T_AlterSystemStmt,
/*

View File

@ -1406,6 +1406,7 @@ typedef enum ObjectType {
OBJECT_INTERNAL_PARTITION,
OBJECT_LANGUAGE,
OBJECT_LARGEOBJECT,
OBJECT_MATVIEW,
OBJECT_OPCLASS,
OBJECT_OPERATOR,
OBJECT_OPFAMILY,
@ -3291,6 +3292,9 @@ typedef struct ExplainStmt {
* A query written as SELECT ... INTO will be transformed to this form during
* parse analysis.
*
* A query written as CREATE MATERIALIZED view will produce this node type,
* during parse analysis, since it needs all the same data.
*
* The "query" field is handled similarly to EXPLAIN, though note that it
* can be a SELECT or an EXECUTE, but not other DML statements.
* ----------------------
@ -3299,6 +3303,7 @@ typedef struct CreateTableAsStmt {
NodeTag type;
Node* query; /* the query (see comments above) */
IntoClause* into; /* destination table */
ObjectType relkind; /* OBJECT_TABLE or OBJECT_MATVIEW */
bool is_select_into; /* it was written as SELECT INTO */
#ifdef PGXC
void* parserSetup;
@ -3306,6 +3311,17 @@ typedef struct CreateTableAsStmt {
#endif
} CreateTableAsStmt;
/* ----------------------
* REFRESH MATERIALIZED VIEW Statement
* ----------------------
*/
typedef struct RefreshMatViewStmt
{
NodeTag type;
bool skipData; /* true for WITH NO DATA */
RangeVar *relation; /* relation to insert into */
} RefreshMatViewStmt;
/* ----------------------
* Checkpoint Statement
* ----------------------
@ -3352,7 +3368,7 @@ typedef struct ConstraintsSetStmt {
*/
typedef struct ReindexStmt {
NodeTag type;
ObjectType kind; /* OBJECT_INDEX, OBJECT_TABLE, OBJECT_INTERNAL, OBJECT_DATABASE */
ObjectType kind; /* OBJECT_INDEX, OBJECT_TABLE, OBJECT_INTERNAL, etc */
RangeVar* relation; /* Table or index to reindex */
const char* name; /* name of database to reindex */
bool do_system; /* include system tables in database case */

View File

@ -93,7 +93,11 @@ typedef struct RangeVar {
} RangeVar;
/*
* IntoClause - target information for SELECT INTO and CREATE TABLE AS
* IntoClause - target information for SELECT INTO, CREATE MATERIALIZED VIEW and CREATE TABLE AS
*
* For CREATE MATERIALIZED VIEW, viewQuery is the parsed-but-not-rewritten
* SELECT Query for the view; otherwise it's NULL. (Although it's actually
* Query*, we declare it as Node* to avoid a forward reference.)
*/
typedef struct IntoClause {
NodeTag type;
@ -104,6 +108,7 @@ typedef struct IntoClause {
OnCommitAction onCommit; /* what do we do at COMMIT? */
int8 row_compress; /* row compression flag */
char* tableSpaceName; /* table space to use, or NULL */
Node* viewQuery; /* materialized view's SELECT query */
bool skipData; /* true for WITH NO DATA */
#ifdef PGXC
struct DistributeBy* distributeby; /* distribution to use, or NULL */