1 /*-------------------------------------------------------------------------
2  *
3  * pg_dist_shard.h
4  *	  definition of the "shard" relation (pg_dist_shard).
5  *
6  * This table maps logical tables to their remote partitions (from this point
7  * on, we use the terms remote partition and shard interchangeably). All changes
8  * concerning the creation, deletion, merging, and split of remote partitions
9  * reference this table.
10  *
11  * Copyright (c) Citus Data, Inc.
12  *
13  *-------------------------------------------------------------------------
14  */
15 
16 #ifndef PG_DIST_SHARD_H
17 #define PG_DIST_SHARD_H
18 
19 /* ----------------
20  *		pg_dist_shard definition.
21  * ----------------
22  */
23 typedef struct FormData_pg_dist_shard
24 {
25 	Oid logicalrelid;         /* logical relation id; references pg_class oid */
26 	int64 shardid;            /* global shardId representing remote partition */
27 	char shardstorage;        /* shard storage type; see codes below */
28 #ifdef CATALOG_VARLEN           /* variable-length fields start here */
29 	text shardalias_DROPPED;      /* dropped column, not in use */
30 	text shardminvalue;        /* partition key's minimum value in shard */
31 	text shardmaxvalue;        /* partition key's maximum value in shard */
32 #endif
33 } FormData_pg_dist_shard;
34 
35 /* ----------------
36  *      Form_pg_dist_shards corresponds to a pointer to a tuple with
37  *      the format of pg_dist_shards relation.
38  * ----------------
39  */
40 typedef FormData_pg_dist_shard *Form_pg_dist_shard;
41 
42 /* ----------------
43  *      compiler constants for pg_dist_shards
44  * ----------------
45  */
46 #define Natts_pg_dist_shard 6
47 #define Anum_pg_dist_shard_logicalrelid 1
48 #define Anum_pg_dist_shard_shardid 2
49 #define Anum_pg_dist_shard_shardstorage 3
50 #define Anum_pg_dist_shard_shardalias_DROPPED 4
51 #define Anum_pg_dist_shard_shardminvalue 5
52 #define Anum_pg_dist_shard_shardmaxvalue 6
53 
54 /*
55  * Valid values for shard storage types include foreign table, (standard) table
56  * and columnar table.
57  */
58 #define SHARD_STORAGE_FOREIGN 'f'
59 #define SHARD_STORAGE_TABLE 't'
60 #define SHARD_STORAGE_COLUMNAR 'c'
61 #define SHARD_STORAGE_VIRTUAL 'v'
62 
63 
64 #endif   /* PG_DIST_SHARD_H */
65