1 /*-------------------------------------------------------------------------
2  *
3  * cluster.h
4  *	  header file for postgres cluster command stuff
5  *
6  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994-5, Regents of the University of California
8  *
9  * src/include/commands/cluster.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef CLUSTER_H
14 #define CLUSTER_H
15 
16 #include "nodes/parsenodes.h"
17 #include "parser/parse_node.h"
18 #include "storage/lock.h"
19 #include "utils/relcache.h"
20 
21 
22 /* flag bits for ClusterParams->flags */
23 #define CLUOPT_RECHECK 0x01		/* recheck relation state */
24 #define CLUOPT_VERBOSE 0x02		/* print progress info */
25 
26 /* options for CLUSTER */
27 typedef struct ClusterParams
28 {
29 	bits32		options;		/* bitmask of CLUOPT_* */
30 } ClusterParams;
31 
32 extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel);
33 extern void cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params);
34 extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid,
35 									   bool recheck, LOCKMODE lockmode);
36 extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal);
37 
38 extern Oid	make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, char relpersistence,
39 						  LOCKMODE lockmode);
40 extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
41 							 bool is_system_catalog,
42 							 bool swap_toast_by_content,
43 							 bool check_constraints,
44 							 bool is_internal,
45 							 TransactionId frozenXid,
46 							 MultiXactId minMulti,
47 							 char newrelpersistence);
48 
49 #endif							/* CLUSTER_H */
50