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

Commit c7932a3

Browse files
committed
removed unnecessary third party pg_*.h files
1 parent 2f8ced2 commit c7932a3

File tree

4 files changed

+83
-491
lines changed

4 files changed

+83
-491
lines changed

src/include/parser/parsenodes.h

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

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

1818
typedef enum SetOperation {
1919
SETOP_NONE = 0,
@@ -73,7 +73,8 @@ 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 the
76+
* that compares the lefthand value(s) to PARAM_SUBLINK nodes representing
77+
*the
7778
* output columns of the subselect. And subselect is transformed to a Query.
7879
* This is the representation seen in saved rules and in the rewriter.
7980
*
@@ -89,28 +90,25 @@ typedef struct Expr { NodeTag type; } Expr;
8990
* The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used
9091
* in SubPlans generated for WITH subqueries.
9192
*/
92-
typedef enum SubLinkType
93-
{
93+
typedef enum SubLinkType {
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-
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 */
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 */
114112
} SubLink;
115113

116114
typedef struct BoolExpr {
@@ -650,8 +648,8 @@ typedef struct DropStmt {
650648

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

657655
typedef struct TruncateStmt {
@@ -708,47 +706,42 @@ typedef struct CreateDatabaseStmt {
708706
List *options; /* List of DefElem nodes */
709707
} CreateDatabaseStmt;
710708

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? */
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? */
718715
} CreateSchemaStmt;
719716

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" */
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" */
726722
} RoleSpecType;
727723

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 */
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 */
734729
} RoleSpec;
735730

736-
typedef enum ViewCheckOption
737-
{
731+
typedef enum ViewCheckOption {
738732
NO_CHECK_OPTION,
739733
LOCAL_CHECK_OPTION,
740734
CASCADED_CHECK_OPTION
741735
} ViewCheckOption;
742736

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 */
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 */
752745
} ViewStmt;
753746

754747
typedef struct ParamRef {
@@ -774,29 +767,26 @@ typedef struct VacuumStmt {
774767
List *va_cols; /* list of column names, or NIL for all */
775768
} VacuumStmt;
776769

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 */
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 */
785777
} VariableSetKind;
786778

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

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

802792
/// ********** For UDFs *********** ///

src/include/parser/pg_query.h

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

13-
1413
#ifndef PG_QUERY_H
1514
#define PG_QUERY_H
1615

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

1918
typedef struct {
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)
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)
2625
} PgQueryError;
2726

2827
typedef struct {
29-
char* parse_tree;
30-
char* stderr_buffer;
31-
PgQueryError* error;
28+
char *parse_tree;
29+
char *stderr_buffer;
30+
PgQueryError *error;
3231
} PgQueryParseResult;
3332

3433
typedef struct {
35-
char* plpgsql_funcs;
36-
PgQueryError* error;
34+
char *plpgsql_funcs;
35+
PgQueryError *error;
3736
} PgQueryPlpgsqlParseResult;
3837

3938
typedef struct {
40-
char* hexdigest;
41-
char* stderr_buffer;
42-
PgQueryError* error;
39+
char *hexdigest;
40+
char *stderr_buffer;
41+
PgQueryError *error;
4342
} PgQueryFingerprintResult;
4443

4544
typedef struct {
46-
char* normalized_query;
47-
PgQueryError* error;
45+
char *normalized_query;
46+
PgQueryError *error;
4847
} PgQueryNormalizeResult;
4948

5049
typedef struct {
5150
List *tree;
52-
char* stderr_buffer;
53-
PgQueryError* error;
51+
char *stderr_buffer;
52+
PgQueryError *error;
5453
} PgQueryInternalParsetreeAndError;
5554

5655
#ifdef __cplusplus
5756
extern "C" {
5857
#endif
5958

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);
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);
6665

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

6968
void pg_query_free_normalize_result(PgQueryNormalizeResult result);
7069
void pg_query_free_parse_result(PgQueryInternalParsetreeAndError result);
7170
void pg_query_free_plpgsql_parse_result(PgQueryPlpgsqlParseResult result);
7271
void pg_query_free_fingerprint_result(PgQueryFingerprintResult result);
7372

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

7877
#ifdef __cplusplus
7978
}

0 commit comments

Comments
 (0)