Skip to content

Commit aca89ae

Browse files
committed
Switched to scanner_isspace for Postgres 17+ - resolves #942
1 parent c9875f5 commit aca89ae

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

src/halfvec.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#include "varatt.h"
2424
#endif
2525

26+
#if PG_VERSION_NUM >= 170000
27+
#include "parser/scansup.h"
28+
#endif
29+
2630
#define STATE_DIMS(x) (ARR_DIMS(x)[0] - 1)
2731
#define CreateStateDatums(dim) palloc(sizeof(Datum) * (dim + 1))
2832

@@ -133,9 +137,9 @@ InitHalfVector(int dim)
133137
return result;
134138
}
135139

136-
/*
137-
* Check for whitespace, since array_isspace() is static
138-
*/
140+
#if PG_VERSION_NUM >= 170000
141+
#define halfvec_isspace(ch) scanner_isspace(ch)
142+
#else
139143
static inline bool
140144
halfvec_isspace(char ch)
141145
{
@@ -148,6 +152,7 @@ halfvec_isspace(char ch)
148152
return true;
149153
return false;
150154
}
155+
#endif
151156

152157
/*
153158
* Check state array

src/sparsevec.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#include "varatt.h"
2323
#endif
2424

25+
#if PG_VERSION_NUM >= 170000
26+
#include "parser/scansup.h"
27+
#endif
28+
2529
typedef struct SparseInputElement
2630
{
2731
int32 index;
@@ -155,9 +159,9 @@ InitSparseVector(int dim, int nnz)
155159
return result;
156160
}
157161

158-
/*
159-
* Check for whitespace, since array_isspace() is static
160-
*/
162+
#if PG_VERSION_NUM >= 170000
163+
#define sparsevec_isspace(ch) scanner_isspace(ch)
164+
#else
161165
static inline bool
162166
sparsevec_isspace(char ch)
163167
{
@@ -170,6 +174,7 @@ sparsevec_isspace(char ch)
170174
return true;
171175
return false;
172176
}
177+
#endif
173178

174179
/*
175180
* Compare indices

src/vector.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
#include "varatt.h"
2727
#endif
2828

29+
#if PG_VERSION_NUM >= 170000
30+
#include "parser/scansup.h"
31+
#endif
32+
2933
#define STATE_DIMS(x) (ARR_DIMS(x)[0] - 1)
3034
#define CreateStateDatums(dim) palloc(sizeof(Datum) * (dim + 1))
3135

@@ -129,9 +133,9 @@ InitVector(int dim)
129133
return result;
130134
}
131135

132-
/*
133-
* Check for whitespace, since array_isspace() is static
134-
*/
136+
#if PG_VERSION_NUM >= 170000
137+
#define vector_isspace(ch) scanner_isspace(ch)
138+
#else
135139
static inline bool
136140
vector_isspace(char ch)
137141
{
@@ -144,6 +148,7 @@ vector_isspace(char ch)
144148
return true;
145149
return false;
146150
}
151+
#endif
147152

148153
/*
149154
* Check state array

0 commit comments

Comments
 (0)