Add empty placeholder LINGUAS file for pg_combinebackup.
[pgsql.git] / src / bin / pgbench / pgbench.h
blobacaa54cd6f84077f0c6d51c1725cc99319628042
1 /*-------------------------------------------------------------------------
3 * pgbench.h
5 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
6 * Portions Copyright (c) 1994, Regents of the University of California
8 *-------------------------------------------------------------------------
9 */
11 #ifndef PGBENCH_H
12 #define PGBENCH_H
14 #include "fe_utils/psqlscan.h"
17 * This file is included outside exprscan.l, in places where we can't see
18 * flex's definition of typedef yyscan_t. Fortunately, it's documented as
19 * being "void *", so we can use a macro to keep the function declarations
20 * here looking like the definitions in exprscan.l. exprparse.y and
21 * pgbench.c also use this to be able to declare things as "yyscan_t".
23 #define yyscan_t void *
26 * Likewise, we can't see exprparse.y's definition of union YYSTYPE here,
27 * but for now there's no need to know what the union contents are.
29 union YYSTYPE;
32 * Variable types used in parser.
34 typedef enum
36 PGBT_NO_VALUE = 0,
37 PGBT_NULL,
38 PGBT_INT,
39 PGBT_DOUBLE,
40 PGBT_BOOLEAN,
41 /* add other types here */
42 } PgBenchValueType;
44 typedef struct
46 PgBenchValueType type;
47 union
49 int64 ival;
50 double dval;
51 bool bval;
52 /* add other types here */
53 } u;
54 } PgBenchValue;
56 /* Types of expression nodes */
57 typedef enum PgBenchExprType
59 ENODE_CONSTANT,
60 ENODE_VARIABLE,
61 ENODE_FUNCTION,
62 } PgBenchExprType;
64 /* List of operators and callable functions */
65 typedef enum PgBenchFunction
67 PGBENCH_ADD,
68 PGBENCH_SUB,
69 PGBENCH_MUL,
70 PGBENCH_DIV,
71 PGBENCH_MOD,
72 PGBENCH_DEBUG,
73 PGBENCH_ABS,
74 PGBENCH_LEAST,
75 PGBENCH_GREATEST,
76 PGBENCH_INT,
77 PGBENCH_DOUBLE,
78 PGBENCH_PI,
79 PGBENCH_SQRT,
80 PGBENCH_LN,
81 PGBENCH_EXP,
82 PGBENCH_RANDOM,
83 PGBENCH_RANDOM_GAUSSIAN,
84 PGBENCH_RANDOM_EXPONENTIAL,
85 PGBENCH_RANDOM_ZIPFIAN,
86 PGBENCH_POW,
87 PGBENCH_AND,
88 PGBENCH_OR,
89 PGBENCH_NOT,
90 PGBENCH_BITAND,
91 PGBENCH_BITOR,
92 PGBENCH_BITXOR,
93 PGBENCH_LSHIFT,
94 PGBENCH_RSHIFT,
95 PGBENCH_EQ,
96 PGBENCH_NE,
97 PGBENCH_LE,
98 PGBENCH_LT,
99 PGBENCH_IS,
100 PGBENCH_CASE,
101 PGBENCH_HASH_FNV1A,
102 PGBENCH_HASH_MURMUR2,
103 PGBENCH_PERMUTE,
104 } PgBenchFunction;
106 typedef struct PgBenchExpr PgBenchExpr;
107 typedef struct PgBenchExprLink PgBenchExprLink;
108 typedef struct PgBenchExprList PgBenchExprList;
110 struct PgBenchExpr
112 PgBenchExprType etype;
113 union
115 PgBenchValue constant;
116 struct
118 char *varname;
119 } variable;
120 struct
122 PgBenchFunction function;
123 PgBenchExprLink *args;
124 } function;
125 } u;
128 /* List of expression nodes */
129 struct PgBenchExprLink
131 PgBenchExpr *expr;
132 PgBenchExprLink *next;
135 struct PgBenchExprList
137 PgBenchExprLink *head;
138 PgBenchExprLink *tail;
141 extern PgBenchExpr *expr_parse_result;
143 extern int expr_yyparse(yyscan_t yyscanner);
144 extern int expr_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner);
145 extern void expr_yyerror(yyscan_t yyscanner, const char *message) pg_attribute_noreturn();
146 extern void expr_yyerror_more(yyscan_t yyscanner, const char *message,
147 const char *more) pg_attribute_noreturn();
148 extern bool expr_lex_one_word(PsqlScanState state, PQExpBuffer word_buf,
149 int *offset);
150 extern yyscan_t expr_scanner_init(PsqlScanState state,
151 const char *source, int lineno, int start_offset,
152 const char *command);
153 extern void expr_scanner_finish(yyscan_t yyscanner);
154 extern int expr_scanner_offset(PsqlScanState state);
155 extern char *expr_scanner_get_substring(PsqlScanState state,
156 int start_offset, int end_offset,
157 bool chomp);
158 extern int expr_scanner_get_lineno(PsqlScanState state, int offset);
160 extern void syntax_error(const char *source, int lineno, const char *line,
161 const char *command, const char *msg,
162 const char *more, int column) pg_attribute_noreturn();
164 extern bool strtoint64(const char *str, bool errorOK, int64 *result);
165 extern bool strtodouble(const char *str, bool errorOK, double *dv);
167 #endif /* PGBENCH_H */