Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c252a17

Browse files
committed
Rename frontend keyword arrays to avoid conflict with backend.
ecpg and pg_dump each contain keyword arrays with structure similar to the backend's keyword array. Up to now, we actually named those arrays the same as the backend's and relied on parser/keywords.h to declare them. This seems a tad too cute, though, and it breaks now that we need to PGDLLIMPORT-decorate the backend symbols. Rename to avoid the problem. Per buildfarm. (It strikes me that maybe we should get rid of the separate keywords.c files altogether, and just define these arrays in the modules that use them, but that's a rather more invasive change.)
1 parent a52e6fe commit c252a17

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/bin/pg_dump/dumputils.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#include "parser/keywords.h"
2323

2424

25+
/* Globals from keywords.c */
26+
extern const ScanKeyword FEScanKeywords[];
27+
extern const int NumFEScanKeywords;
28+
2529
/* Globals exported by this file */
2630
int quote_all_identifiers = 0;
2731
const char *progname = NULL;
@@ -150,8 +154,8 @@ fmtId(const char *rawid)
150154
* that's fine, since we already know we have all-lower-case.
151155
*/
152156
const ScanKeyword *keyword = ScanKeywordLookup(rawid,
153-
ScanKeywords,
154-
NumScanKeywords);
157+
FEScanKeywords,
158+
NumFEScanKeywords);
155159

156160
if (keyword != NULL && keyword->category != UNRESERVED_KEYWORD)
157161
need_quotes = true;

src/bin/pg_dump/keywords.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
*/
2424
#define PG_KEYWORD(a,b,c) {a,0,c},
2525

26-
const ScanKeyword ScanKeywords[] = {
26+
const ScanKeyword FEScanKeywords[] = {
2727
#include "parser/kwlist.h"
2828
};
2929

30-
const int NumScanKeywords = lengthof(ScanKeywords);
30+
const int NumFEScanKeywords = lengthof(FEScanKeywords);

src/interfaces/ecpg/preproc/ecpg_keywords.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616
#include "extern.h"
1717
#include "preproc.h"
1818

19+
/* Globals from keywords.c */
20+
extern const ScanKeyword SQLScanKeywords[];
21+
extern const int NumSQLScanKeywords;
22+
1923
/*
2024
* List of (keyword-name, keyword-token-value) pairs.
2125
*
2226
* !!WARNING!!: This list must be sorted, because binary
2327
* search is used to locate entries.
2428
*/
25-
static const ScanKeyword ScanECPGKeywords[] = {
29+
static const ScanKeyword ECPGScanKeywords[] = {
2630
/* name, value, category */
2731

2832
/*
@@ -87,12 +91,12 @@ ScanECPGKeywordLookup(const char *text)
8791
const ScanKeyword *res;
8892

8993
/* First check SQL symbols defined by the backend. */
90-
res = ScanKeywordLookup(text, ScanKeywords, NumScanKeywords);
94+
res = ScanKeywordLookup(text, SQLScanKeywords, NumSQLScanKeywords);
9195
if (res)
9296
return res;
9397

9498
/* Try ECPG-specific keywords. */
95-
res = ScanKeywordLookup(text, ScanECPGKeywords, lengthof(ScanECPGKeywords));
99+
res = ScanKeywordLookup(text, ECPGScanKeywords, lengthof(ECPGScanKeywords));
96100
if (res)
97101
return res;
98102

src/interfaces/ecpg/preproc/keywords.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#define PG_KEYWORD(a,b,c) {a,b,c},
2323

2424

25-
const ScanKeyword ScanKeywords[] = {
25+
const ScanKeyword SQLScanKeywords[] = {
2626
#include "parser/kwlist.h"
2727
};
2828

29-
const int NumScanKeywords = lengthof(ScanKeywords);
29+
const int NumSQLScanKeywords = lengthof(SQLScanKeywords);

0 commit comments

Comments
 (0)