Skip to content

Commit e678c3e

Browse files
committed
clean pg_compat.c & pg_compat.h, add PostgreSQL 9.6 to Travis CI
1 parent 5aab5f1 commit e678c3e

File tree

6 files changed

+47
-50
lines changed

6 files changed

+47
-50
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ before_install:
1414
- sudo sh ./travis/apt.postgresql.org.sh
1515

1616
env:
17+
- PGVERSION=9.6 CHECK_CODE=true
18+
- PGVERSION=9.6 CHECK_CODE=false
1719
- PGVERSION=9.5 CHECK_CODE=true
1820
- PGVERSION=9.5 CHECK_CODE=false
1921

src/init.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "access/sysattr.h"
2323
#include "catalog/indexing.h"
2424
#include "catalog/pg_constraint.h"
25-
#include "catalog/pg_constraint_fn.h"
2625
#include "catalog/pg_inherits.h"
2726
#include "catalog/pg_inherits_fn.h"
2827
#include "catalog/pg_type.h"
@@ -38,6 +37,10 @@
3837
#include "utils/syscache.h"
3938
#include "utils/typcache.h"
4039

40+
#if PG_VERSION_NUM >= 90600
41+
#include "catalog/pg_constraint_fn.h"
42+
#endif
43+
4144

4245
/* Help user in case of emergency */
4346
#define INIT_ERROR_HINT "pg_pathman will be disabled to allow you to resolve this issue"

src/nodes_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#include "postgres.h"
1717
#include "commands/explain.h"
1818
#include "optimizer/planner.h"
19+
20+
#if PG_VERSION_NUM >= 90600
1921
#include "nodes/extensible.h"
22+
#endif
2023

2124

2225
/*

src/partition_filter.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
#include "postgres.h"
1818
#include "commands/explain.h"
1919
#include "optimizer/planner.h"
20+
21+
#if PG_VERSION_NUM >= 90600
2022
#include "nodes/extensible.h"
23+
#endif
24+
2125

2226
typedef struct
2327
{

src/pg_compat.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/* ------------------------------------------------------------------------
2+
*
3+
* pg_compat.c
4+
* Compatibility tools
5+
*
6+
* Copyright (c) 2016, Postgres Professional
7+
*
8+
* ------------------------------------------------------------------------
9+
*/
10+
111
#include "pg_compat.h"
212

313
#include "optimizer/pathnode.h"
@@ -6,23 +16,6 @@
616

717
#include <math.h>
818

9-
/*
10-
double
11-
get_parameterized_joinrel_size_compat(PlannerInfo *root, RelOptInfo *rel,
12-
Path *outer_path, Path *inner_path,
13-
SpecialJoinInfo *sjinfo,
14-
List *restrict_clauses)
15-
{
16-
#if PG_VERSION_NUM >= 90600
17-
return get_parameterized_joinrel_size(root, rel, outer_path, inner_path,
18-
sjinfo, restrict_clauses);
19-
#else
20-
return get_parameterized_joinrel_size(root, rel, outer_path->rows,
21-
inner_path->rows, sjinfo,
22-
#endif
23-
restrict_clauses);
24-
}
25-
*/
2619

2720
void
2821
set_append_rel_size_compat(PlannerInfo *root, RelOptInfo *rel,

src/pg_compat.h

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/* ------------------------------------------------------------------------
2+
*
3+
* pg_compat.h
4+
* Compatibility tools
5+
*
6+
* Copyright (c) 2016, Postgres Professional
7+
*
8+
* ------------------------------------------------------------------------
9+
*/
10+
111
#ifndef PG_COMPAT_H
212
#define PG_COMPAT_H
313

@@ -8,38 +18,24 @@
818
#include "optimizer/cost.h"
919
#include "optimizer/paths.h"
1020

11-
/*
12-
extern double get_parameterized_joinrel_size_compat(PlannerInfo *root,
13-
RelOptInfo *rel,
14-
Path *outer_path,
15-
Path *inner_path,
16-
SpecialJoinInfo *sjinfo,
17-
List *restrict_clauses);
18-
*/
21+
1922
extern void set_append_rel_size_compat(PlannerInfo *root, RelOptInfo *rel,
2023
Index rti, RangeTblEntry *rte);
2124
extern void copy_targetlist_compat(RelOptInfo *dest, RelOptInfo *rel);
2225

2326
#if PG_VERSION_NUM >= 90600
2427

25-
#define get_parameterized_joinrel_size_compat(root, \
26-
rel, \
27-
outer_path, \
28-
inner_path, \
29-
sjinfo, \
28+
#define get_parameterized_joinrel_size_compat(root, rel, outer_path, \
29+
inner_path, sjinfo, \
3030
restrict_clauses) \
31-
get_parameterized_joinrel_size(root, \
32-
rel, \
33-
outer_path, \
34-
inner_path, \
35-
sjinfo, \
31+
get_parameterized_joinrel_size(root, rel, outer_path, \
32+
inner_path, sjinfo, \
3633
restrict_clauses)
3734

3835
#define check_index_predicates_compat(rool, rel) \
3936
check_index_predicates(root, rel)
4037

41-
#define create_append_path_compat(rel, subpaths, required_outer, \
42-
parallel_workers) \
38+
#define create_append_path_compat(rel, subpaths, required_outer, parallel_workers) \
4339
create_append_path(rel, subpaths, required_outer, parallel_workers)
4440

4541
#define pull_var_clause_compat(node, aggbehavior, phbehavior) \
@@ -49,26 +45,21 @@ extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
4945
#define make_result_compat(root, tlist, resconstantqual, subplan) \
5046
make_result(tlist, resconstantqual, subplan)
5147

52-
#else
48+
#else /* PG_VERSION_NUM >= 90500 */
5349

54-
#define get_parameterized_joinrel_size_compat(root, \
55-
rel, \
50+
#define get_parameterized_joinrel_size_compat(root, rel, \
5651
outer_path, \
5752
inner_path, \
58-
sjinfo, \
59-
restrict_clauses) \
60-
get_parameterized_joinrel_size(root, \
61-
rel, \
53+
sjinfo, restrict_clauses) \
54+
get_parameterized_joinrel_size(root, rel, \
6255
(outer_path)->rows, \
6356
(inner_path)->rows, \
64-
sjinfo, \
65-
restrict_clauses)
57+
sjinfo, restrict_clauses)
6658

6759
#define check_index_predicates_compat(rool, rel) \
6860
check_partial_indexes(root, rel)
6961

70-
#define create_append_path_compat(rel, subpaths, required_outer, \
71-
parallel_workers) \
62+
#define create_append_path_compat(rel, subpaths, required_outer, parallel_workers) \
7263
create_append_path(rel, subpaths, required_outer)
7364

7465
#define pull_var_clause_compat(node, aggbehavior, phbehavior) \
@@ -79,4 +70,5 @@ extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
7970

8071
#endif
8172

82-
#endif
73+
74+
#endif /* PG_COMPAT_H */

0 commit comments

Comments
 (0)