Skip to content

Commit 4136e1d

Browse files
committed
Convert the list of syscache names from a series of #define's into an enum,
to avoid the pain of manually renumbering them anytime we insert another name in alphabetical order. An excellent idea from Alex Hunsaker and NikhilS' inherited-constraints patch --- whether or not the rest of that gets in, this should. Dunno why we never thought of it before.
1 parent 4222d7f commit 4136e1d

File tree

1 file changed

+56
-54
lines changed

1 file changed

+56
-54
lines changed

src/include/utils/syscache.h

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.71 2008/01/01 19:45:59 momjian Exp $
12+
* $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.72 2008/05/07 01:04:49 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -19,63 +19,65 @@
1919
#include "utils/catcache.h"
2020

2121
/*
22-
* Declarations for util/syscache.c.
23-
*
2422
* SysCache identifiers.
2523
*
26-
* The order of these must match the order
27-
* they are entered into the structure cacheinfo[] in syscache.c.
28-
* Keep them in alphabetical order.
24+
* The order of these identifiers must match the order
25+
* of the entries in the array cacheinfo[] in syscache.c.
26+
* Keep them in alphabetical order (renumbering only costs a
27+
* backend rebuild).
2928
*/
3029

31-
#define AGGFNOID 0
32-
#define AMNAME 1
33-
#define AMOID 2
34-
#define AMOPOPID 3
35-
#define AMOPSTRATEGY 4
36-
#define AMPROCNUM 5
37-
#define ATTNAME 6
38-
#define ATTNUM 7
39-
#define AUTHMEMMEMROLE 8
40-
#define AUTHMEMROLEMEM 9
41-
#define AUTHNAME 10
42-
#define AUTHOID 11
43-
#define CASTSOURCETARGET 12
44-
#define CLAAMNAMENSP 13
45-
#define CLAOID 14
46-
#define CONDEFAULT 15
47-
#define CONNAMENSP 16
48-
#define CONSTROID 17
49-
#define CONVOID 18
50-
#define DATABASEOID 19
51-
#define ENUMOID 20
52-
#define ENUMTYPOIDNAME 21
53-
#define INDEXRELID 22
54-
#define LANGNAME 23
55-
#define LANGOID 24
56-
#define NAMESPACENAME 25
57-
#define NAMESPACEOID 26
58-
#define OPERNAMENSP 27
59-
#define OPEROID 28
60-
#define OPFAMILYAMNAMENSP 29
61-
#define OPFAMILYOID 30
62-
#define PROCNAMEARGSNSP 31
63-
#define PROCOID 32
64-
#define RELNAMENSP 33
65-
#define RELOID 34
66-
#define RULERELNAME 35
67-
#define STATRELATT 36
68-
#define TSCONFIGMAP 37
69-
#define TSCONFIGNAMENSP 38
70-
#define TSCONFIGOID 39
71-
#define TSDICTNAMENSP 40
72-
#define TSDICTOID 41
73-
#define TSPARSERNAMENSP 42
74-
#define TSPARSEROID 43
75-
#define TSTEMPLATENAMENSP 44
76-
#define TSTEMPLATEOID 45
77-
#define TYPENAMENSP 46
78-
#define TYPEOID 47
30+
enum SysCacheIdentifier
31+
{
32+
AGGFNOID = 0,
33+
AMNAME,
34+
AMOID,
35+
AMOPOPID,
36+
AMOPSTRATEGY,
37+
AMPROCNUM,
38+
ATTNAME,
39+
ATTNUM,
40+
AUTHMEMMEMROLE,
41+
AUTHMEMROLEMEM,
42+
AUTHNAME,
43+
AUTHOID,
44+
CASTSOURCETARGET,
45+
CLAAMNAMENSP,
46+
CLAOID,
47+
CONDEFAULT,
48+
CONNAMENSP,
49+
CONSTROID,
50+
CONVOID,
51+
DATABASEOID,
52+
ENUMOID,
53+
ENUMTYPOIDNAME,
54+
INDEXRELID,
55+
LANGNAME,
56+
LANGOID,
57+
NAMESPACENAME,
58+
NAMESPACEOID,
59+
OPERNAMENSP,
60+
OPEROID,
61+
OPFAMILYAMNAMENSP,
62+
OPFAMILYOID,
63+
PROCNAMEARGSNSP,
64+
PROCOID,
65+
RELNAMENSP,
66+
RELOID,
67+
RULERELNAME,
68+
STATRELATT,
69+
TSCONFIGMAP,
70+
TSCONFIGNAMENSP,
71+
TSCONFIGOID,
72+
TSDICTNAMENSP,
73+
TSDICTOID,
74+
TSPARSERNAMENSP,
75+
TSPARSEROID,
76+
TSTEMPLATENAMENSP,
77+
TSTEMPLATEOID,
78+
TYPENAMENSP,
79+
TYPEOID
80+
};
7981

8082
extern void InitCatalogCache(void);
8183
extern void InitCatalogCachePhase2(void);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy