Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit f7fa102

Browse files
committed
revert the removal of pg_*.h files. Build failing
1 parent f91c84b commit f7fa102

File tree

4 files changed

+499
-91
lines changed

4 files changed

+499
-91
lines changed

src/include/parser/parsenodes.h

Lines changed: 73 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <cstdint>
1414

1515
#include "nodes.h"
16-
#include "parser/pg_list.h"
16+
#include "pg_list.h"
1717

1818
typedef enum SetOperation {
1919
SETOP_NONE = 0,
@@ -44,14 +44,14 @@ typedef struct Expr { NodeTag type; } Expr;
4444
* A SubLink represents a subselect appearing in an expression, and in some
4545
* cases also the combining operator(s) just above it. The subLinkType
4646
* indicates the form of the expression represented:
47-
* EXISTS_SUBLINK EXISTS(SELECT ...)
48-
* ALL_SUBLINK (lefthand) op ALL (SELECT ...)
49-
* ANY_SUBLINK (lefthand) op ANY (SELECT ...)
50-
* ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...)
51-
* EXPR_SUBLINK (SELECT with single targetlist item ...)
52-
* MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...)
53-
* ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...)
54-
* CTE_SUBLINK WITH query (never actually part of an expression)
47+
* EXISTS_SUBLINK EXISTS(SELECT ...)
48+
* ALL_SUBLINK (lefthand) op ALL (SELECT ...)
49+
* ANY_SUBLINK (lefthand) op ANY (SELECT ...)
50+
* ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...)
51+
* EXPR_SUBLINK (SELECT with single targetlist item ...)
52+
* MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...)
53+
* ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...)
54+
* CTE_SUBLINK WITH query (never actually part of an expression)
5555
* For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the
5656
* same length as the subselect's targetlist. ROWCOMPARE will *always* have
5757
* a list with more than one entry; if the subselect has just one target
@@ -73,8 +73,7 @@ typedef struct Expr { NodeTag type; } Expr;
7373
* of the lefthand expression (if any), and operName is the String name of
7474
* the combining operator. Also, subselect is a raw parsetree. During parse
7575
* analysis, the parser transforms testexpr into a complete boolean expression
76-
* that compares the lefthand value(s) to PARAM_SUBLINK nodes representing
77-
*the
76+
* that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the
7877
* output columns of the subselect. And subselect is transformed to a Query.
7978
* This is the representation seen in saved rules and in the rewriter.
8079
*
@@ -90,25 +89,28 @@ typedef struct Expr { NodeTag type; } Expr;
9089
* The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used
9190
* in SubPlans generated for WITH subqueries.
9291
*/
93-
typedef enum SubLinkType {
92+
typedef enum SubLinkType
93+
{
9494
EXISTS_SUBLINK,
9595
ALL_SUBLINK,
9696
ANY_SUBLINK,
9797
ROWCOMPARE_SUBLINK,
9898
EXPR_SUBLINK,
9999
MULTIEXPR_SUBLINK,
100100
ARRAY_SUBLINK,
101-
CTE_SUBLINK /* for SubPlans only */
101+
CTE_SUBLINK /* for SubPlans only */
102102
} SubLinkType;
103103

104-
typedef struct SubLink {
105-
Expr xpr;
106-
SubLinkType subLinkType; /* see above */
107-
int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */
108-
Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */
109-
List *operName; /* originally specified operator name */
110-
Node *subselect; /* subselect as Query* or raw parsetree */
111-
int location; /* token location, or -1 if unknown */
104+
105+
typedef struct SubLink
106+
{
107+
Expr xpr;
108+
SubLinkType subLinkType; /* see above */
109+
int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */
110+
Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */
111+
List *operName; /* originally specified operator name */
112+
Node *subselect; /* subselect as Query* or raw parsetree */
113+
int location; /* token location, or -1 if unknown */
112114
} SubLink;
113115

114116
typedef struct BoolExpr {
@@ -648,8 +650,8 @@ typedef struct DropStmt {
648650

649651
typedef struct DropDatabaseStmt {
650652
NodeTag type;
651-
char *dbname; /* name of database to drop */
652-
bool missing_ok; /* skip error if object is missing? */
653+
char *dbname; /* name of database to drop */
654+
bool missing_ok; /* skip error if object is missing? */
653655
} DropDatabaseStmt;
654656

655657
typedef struct TruncateStmt {
@@ -706,42 +708,47 @@ typedef struct CreateDatabaseStmt {
706708
List *options; /* List of DefElem nodes */
707709
} CreateDatabaseStmt;
708710

709-
typedef struct CreateSchemaStmt {
710-
NodeTag type;
711-
char *schemaname; /* the name of the schema to create */
712-
Node *authrole; /* the owner of the created schema */
713-
List *schemaElts; /* schema components (list of parsenodes) */
714-
bool if_not_exists; /* just do nothing if schema already exists? */
711+
typedef struct CreateSchemaStmt
712+
{
713+
NodeTag type;
714+
char *schemaname; /* the name of the schema to create */
715+
Node *authrole; /* the owner of the created schema */
716+
List *schemaElts; /* schema components (list of parsenodes) */
717+
bool if_not_exists; /* just do nothing if schema already exists? */
715718
} CreateSchemaStmt;
716719

717-
typedef enum RoleSpecType {
718-
ROLESPEC_CSTRING, /* role name is stored as a C string */
719-
ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
720-
ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
721-
ROLESPEC_PUBLIC /* role name is "public" */
720+
typedef enum RoleSpecType
721+
{
722+
ROLESPEC_CSTRING, /* role name is stored as a C string */
723+
ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
724+
ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
725+
ROLESPEC_PUBLIC /* role name is "public" */
722726
} RoleSpecType;
723727

724-
typedef struct RoleSpec {
725-
NodeTag type;
726-
RoleSpecType roletype; /* Type of this rolespec */
727-
char *rolename; /* filled only for ROLESPEC_CSTRING */
728-
int location; /* token location, or -1 if unknown */
728+
typedef struct RoleSpec
729+
{
730+
NodeTag type;
731+
RoleSpecType roletype; /* Type of this rolespec */
732+
char *rolename; /* filled only for ROLESPEC_CSTRING */
733+
int location; /* token location, or -1 if unknown */
729734
} RoleSpec;
730735

731-
typedef enum ViewCheckOption {
736+
typedef enum ViewCheckOption
737+
{
732738
NO_CHECK_OPTION,
733739
LOCAL_CHECK_OPTION,
734740
CASCADED_CHECK_OPTION
735741
} ViewCheckOption;
736742

737-
typedef struct ViewStmt {
738-
NodeTag type;
739-
RangeVar *view; /* the view to be created */
740-
List *aliases; /* target column names */
741-
Node *query; /* the SELECT query */
742-
bool replace; /* replace an existing view? */
743-
List *options; /* options from WITH clause */
744-
ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
743+
typedef struct ViewStmt
744+
{
745+
NodeTag type;
746+
RangeVar *view; /* the view to be created */
747+
List *aliases; /* target column names */
748+
Node *query; /* the SELECT query */
749+
bool replace; /* replace an existing view? */
750+
List *options; /* options from WITH clause */
751+
ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
745752
} ViewStmt;
746753

747754
typedef struct ParamRef {
@@ -767,26 +774,29 @@ typedef struct VacuumStmt {
767774
List *va_cols; /* list of column names, or NIL for all */
768775
} VacuumStmt;
769776

770-
typedef enum {
771-
VAR_SET_VALUE, /* SET var = value */
772-
VAR_SET_DEFAULT, /* SET var TO DEFAULT */
773-
VAR_SET_CURRENT, /* SET var FROM CURRENT */
774-
VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
775-
VAR_RESET, /* RESET var */
776-
VAR_RESET_ALL /* RESET ALL */
777+
typedef enum
778+
{
779+
VAR_SET_VALUE, /* SET var = value */
780+
VAR_SET_DEFAULT, /* SET var TO DEFAULT */
781+
VAR_SET_CURRENT, /* SET var FROM CURRENT */
782+
VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
783+
VAR_RESET, /* RESET var */
784+
VAR_RESET_ALL /* RESET ALL */
777785
} VariableSetKind;
778786

779-
typedef struct VariableSetStmt {
780-
NodeTag type;
787+
typedef struct VariableSetStmt
788+
{
789+
NodeTag type;
781790
VariableSetKind kind;
782-
char *name; /* variable to be set */
783-
List *args; /* List of A_Const nodes */
784-
bool is_local; /* SET LOCAL? */
791+
char *name; /* variable to be set */
792+
List *args; /* List of A_Const nodes */
793+
bool is_local; /* SET LOCAL? */
785794
} VariableSetStmt;
786795

787-
typedef struct VariableShowStmt {
788-
NodeTag type;
789-
char *name;
796+
typedef struct VariableShowStmt
797+
{
798+
NodeTag type;
799+
char *name;
790800
} VariableShowStmt;
791801

792802
/// ********** For UDFs *********** ///

src/include/parser/pg_query.h

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,69 +10,70 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
1314
#ifndef PG_QUERY_H
1415
#define PG_QUERY_H
1516

16-
#include "parser/pg_list.h"
17+
#include "pg_list.h"
1718

1819
typedef struct {
19-
char *message; // exception message
20-
char *funcname; // source function of exception (e.g. SearchSysCache)
21-
char *filename; // source of exception (e.g. parse.l)
22-
int lineno; // source of exception (e.g. 104)
23-
int cursorpos; // char in query at which exception occurred
24-
char *context; // additional context (optional, can be NULL)
20+
char* message; // exception message
21+
char* funcname; // source function of exception (e.g. SearchSysCache)
22+
char* filename; // source of exception (e.g. parse.l)
23+
int lineno; // source of exception (e.g. 104)
24+
int cursorpos; // char in query at which exception occurred
25+
char* context; // additional context (optional, can be NULL)
2526
} PgQueryError;
2627

2728
typedef struct {
28-
char *parse_tree;
29-
char *stderr_buffer;
30-
PgQueryError *error;
29+
char* parse_tree;
30+
char* stderr_buffer;
31+
PgQueryError* error;
3132
} PgQueryParseResult;
3233

3334
typedef struct {
34-
char *plpgsql_funcs;
35-
PgQueryError *error;
35+
char* plpgsql_funcs;
36+
PgQueryError* error;
3637
} PgQueryPlpgsqlParseResult;
3738

3839
typedef struct {
39-
char *hexdigest;
40-
char *stderr_buffer;
41-
PgQueryError *error;
40+
char* hexdigest;
41+
char* stderr_buffer;
42+
PgQueryError* error;
4243
} PgQueryFingerprintResult;
4344

4445
typedef struct {
45-
char *normalized_query;
46-
PgQueryError *error;
46+
char* normalized_query;
47+
PgQueryError* error;
4748
} PgQueryNormalizeResult;
4849

4950
typedef struct {
5051
List *tree;
51-
char *stderr_buffer;
52-
PgQueryError *error;
52+
char* stderr_buffer;
53+
PgQueryError* error;
5354
} PgQueryInternalParsetreeAndError;
5455

5556
#ifdef __cplusplus
5657
extern "C" {
5758
#endif
5859

59-
void print_pg_parse_tree(List *node);
60-
void *pg_query_parse_init();
61-
void pg_query_parse_finish(void *ctx);
62-
PgQueryNormalizeResult pg_query_normalize(const char *input);
63-
PgQueryInternalParsetreeAndError pg_query_parse(const char *input);
64-
PgQueryPlpgsqlParseResult pg_query_parse_plpgsql(const char *input);
60+
void print_pg_parse_tree(List* node);
61+
void* pg_query_parse_init();
62+
void pg_query_parse_finish(void* ctx);
63+
PgQueryNormalizeResult pg_query_normalize(const char* input);
64+
PgQueryInternalParsetreeAndError pg_query_parse(const char* input);
65+
PgQueryPlpgsqlParseResult pg_query_parse_plpgsql(const char* input);
6566

66-
PgQueryFingerprintResult pg_query_fingerprint(const char *input);
67+
PgQueryFingerprintResult pg_query_fingerprint(const char* input);
6768

6869
void pg_query_free_normalize_result(PgQueryNormalizeResult result);
6970
void pg_query_free_parse_result(PgQueryInternalParsetreeAndError result);
7071
void pg_query_free_plpgsql_parse_result(PgQueryPlpgsqlParseResult result);
7172
void pg_query_free_fingerprint_result(PgQueryFingerprintResult result);
7273

74+
7375
// Deprecated APIs below
74-
void pg_query_init(void); // Deprecated as of 9.5-1.4.1, this is now run
75-
// automatically as needed
76+
void pg_query_init(void); // Deprecated as of 9.5-1.4.1, this is now run automatically as needed
7677

7778
#ifdef __cplusplus
7879
}

0 commit comments

Comments
 (0)