Debian Codegraph @

src/bin/pg_dump/filter.h

raw
1 /*-------------------------------------------------------------------------
2 *
3 * filter.h
4 * Common header file for the parser of filter file
5 *
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * IDENTIFICATION
10 * src/bin/pg_dump/filter.h
11 *
12 *-------------------------------------------------------------------------
13 */
14 #ifndef FILTER_H
15 #define FILTER_H
16
17 #include "lib/stringinfo.h"
18
19 /* Function signature for exit_nicely functions */
20 typedef void (*exit_function) (int status);
21
22 /*
23 * State data for reading filter items from stream
24 */
25 typedef struct
26 {
27 FILE *fp;
28 const char *filename;
29 exit_function exit_nicely;
30 int lineno;
31 StringInfoData linebuff;
32 } FilterStateData;
33
34 /*
35 * List of command types that can be specified in filter file
36 */
37 typedef enum
38 {
39 FILTER_COMMAND_TYPE_NONE,
40 FILTER_COMMAND_TYPE_INCLUDE,
41 FILTER_COMMAND_TYPE_EXCLUDE,
42 } FilterCommandType;
43
44 /*
45 * List of objects that can be specified in filter file
46 */
47 typedef enum
48 {
49 FILTER_OBJECT_TYPE_NONE,
50 FILTER_OBJECT_TYPE_TABLE_DATA,
51 FILTER_OBJECT_TYPE_TABLE_DATA_AND_CHILDREN,
52 FILTER_OBJECT_TYPE_DATABASE,
53 FILTER_OBJECT_TYPE_EXTENSION,
54 FILTER_OBJECT_TYPE_FOREIGN_DATA,
55 FILTER_OBJECT_TYPE_FUNCTION,
56 FILTER_OBJECT_TYPE_INDEX,
57 FILTER_OBJECT_TYPE_SCHEMA,
58 FILTER_OBJECT_TYPE_TABLE,
59 FILTER_OBJECT_TYPE_TABLE_AND_CHILDREN,
60 FILTER_OBJECT_TYPE_TRIGGER,
61 } FilterObjectType;
62
63 extern const char *filter_object_type_name(FilterObjectType fot);
64 extern void filter_init(FilterStateData *fstate, const char *filename, exit_function f_exit);
65 extern void filter_free(FilterStateData *fstate);
66 extern void pg_log_filter_error(FilterStateData *fstate, const char *fmt,...)
67 pg_attribute_printf(2, 3);
68 extern bool filter_read_item(FilterStateData *fstate, char **objname,
69 FilterCommandType *comtype, FilterObjectType *objtype);
70
71 #endif /* FILTER_H */