refresh_immv(immv_name, with_data) is a function to refresh IMMV like REFRESH MATERIALIZED VIEW command. It has two argument. immv_name is incrementally maintainable materialized view's name, and with_data is an option that is corresponding to the WITH [NO] DATA option. When with_data is set false, the IMMV gets unpopulated. One of differences between IMMVs unpopulated by this function and normal materialized views unpopulated by REFRESH ... WITH NO DATA is that such IMMVs can be referenced by SELECT but return no rows, while unpopulated materialized views are not scanable. The behaviour may be changed in future to raise an error when unpopulated an IMMV is scanned.
53 lines
1.6 KiB
C
53 lines
1.6 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* pg_ivm.h
|
|
* incremental view maintenance extension
|
|
*
|
|
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 2022, IVM Development Group
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef _PG_IVM_H_
|
|
#define _PG_IVM_H_
|
|
|
|
#include "catalog/objectaddress.h"
|
|
#include "fmgr.h"
|
|
#include "nodes/params.h"
|
|
#include "parser/parse_node.h"
|
|
#include "tcop/dest.h"
|
|
#include "utils/queryenvironment.h"
|
|
|
|
#define Natts_pg_ivm_immv 3
|
|
|
|
#define Anum_pg_ivm_immv_immvrelid 1
|
|
#define Anum_pg_ivm_immv_ispopulated 2
|
|
#define Anum_pg_ivm_immv_viewdef 3
|
|
|
|
/* pg_ivm.c */
|
|
|
|
extern void CreateChangePreventTrigger(Oid matviewOid);
|
|
extern Oid PgIvmImmvRelationId(void);
|
|
extern Oid PgIvmImmvPrimaryKeyIndexId(void);
|
|
|
|
/* createas.c */
|
|
|
|
extern ObjectAddress ExecCreateImmv(ParseState *pstate, CreateTableAsStmt *stmt,
|
|
ParamListInfo params, QueryEnvironment *queryEnv,
|
|
QueryCompletion *qc);
|
|
extern void CreateIvmTriggersOnBaseTables(Query *qry, Oid matviewOid, bool is_create);
|
|
extern void CreateIndexOnIMMV(Query *query, Relation matviewRel, bool is_create);
|
|
extern Query *rewriteQueryForIMMV(Query *query, List *colNames);
|
|
|
|
/* matview.c */
|
|
|
|
extern ObjectAddress ExecRefreshImmv(const char *relname, bool skipData, QueryCompletion *qc);
|
|
extern bool ImmvIncrementalMaintenanceIsEnabled(void);
|
|
extern Datum IVM_immediate_before(PG_FUNCTION_ARGS);
|
|
extern Datum IVM_immediate_maintenance(PG_FUNCTION_ARGS);
|
|
extern void AtAbort_IVM(void);
|
|
extern bool isIvmName(const char *s);
|
|
|
|
|
|
#endif
|