1 /*
2  * This file and its contents are licensed under the Timescale License.
3  * Please see the included NOTICE for copyright information and
4  * LICENSE-TIMESCALE for a copy of the license.
5  */
6 #ifndef TIMESCALEDB_DEPARSE_H
7 #define TIMESCALEDB_DEPARSE_H
8 
9 #include <postgres.h>
10 #include <nodes/pg_list.h>
11 
12 typedef struct TableInfo
13 {
14 	Oid relid;
15 	List *constraints;
16 	List *indexes;
17 	List *triggers;
18 	List *functions;
19 	List *rules;
20 } TableInfo;
21 
22 typedef struct TableDef
23 {
24 	const char *schema_cmd;
25 	const char *create_cmd;
26 	List *constraint_cmds;
27 	List *index_cmds;
28 	List *trigger_cmds;
29 	List *rule_cmds;
30 	List *function_cmds;
31 } TableDef;
32 
33 typedef struct DeparsedHypertableCommands
34 {
35 	const char *table_create_command;
36 	List *dimension_add_commands;
37 	List *grant_commands;
38 } DeparsedHypertableCommands;
39 
40 typedef struct Hypertable Hypertable;
41 
42 TableInfo *deparse_create_table_info(Oid relid);
43 TableDef *deparse_get_tabledef(TableInfo *table_info);
44 List *deparse_get_tabledef_commands(Oid relid);
45 List *deparse_get_tabledef_commands_from_tabledef(TableDef *table_def);
46 const char *deparse_get_tabledef_commands_concat(Oid relid);
47 
48 DeparsedHypertableCommands *deparse_get_distributed_hypertable_create_command(Hypertable *ht);
49 
50 const char *deparse_func_call(FunctionCallInfo finfo);
51 const char *deparse_oid_function_call_coll(Oid funcid, Oid collation, unsigned int num_args, ...);
52 const char *deparse_grant_revoke_on_database(Node *node, const char *dbname);
53 
54 #endif
55