mirror of
https://github.com/postgres/postgres.git
synced 2026-02-27 11:50:33 -05:00
This index array was originally defined to have 10000 entries (ranging up to FirstGenbkiObjectId), but we really only need entries up to the last existing builtin function OID, currently 6121. That saves close to 8K of never-accessed space in the server executable, at the small price of one more fetch in fmgr_isbuiltin(). We could reduce the array size still further by renumbering a few of the highest-numbered builtin functions; but there's a small risk of breaking clients that have chosen to hardwire those function OIDs, so it's not clear if it'd be worth the trouble. (We should, however, discourage future patches from choosing function OIDs above 6K as long as there's still lots of space below that.) Discussion: https://postgr.es/m/12359.1547063064@sss.pgh.pa.us
48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* fmgrtab.h
|
|
* The function manager's table of internal functions.
|
|
*
|
|
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/utils/fmgrtab.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef FMGRTAB_H
|
|
#define FMGRTAB_H
|
|
|
|
#include "access/transam.h"
|
|
#include "fmgr.h"
|
|
|
|
|
|
/*
|
|
* This table stores info about all the built-in functions (ie, functions
|
|
* that are compiled into the Postgres executable).
|
|
*/
|
|
|
|
typedef struct
|
|
{
|
|
Oid foid; /* OID of the function */
|
|
short nargs; /* 0..FUNC_MAX_ARGS, or -1 if variable count */
|
|
bool strict; /* T if function is "strict" */
|
|
bool retset; /* T if function returns a set */
|
|
const char *funcName; /* C name of the function */
|
|
PGFunction func; /* pointer to compiled function */
|
|
} FmgrBuiltin;
|
|
|
|
extern const FmgrBuiltin fmgr_builtins[];
|
|
|
|
extern const int fmgr_nbuiltins; /* number of entries in table */
|
|
|
|
extern const Oid fmgr_last_builtin_oid; /* highest function OID in table */
|
|
|
|
/*
|
|
* Mapping from a builtin function's OID to its index in the fmgr_builtins
|
|
* array. This is indexed from 0 through fmgr_last_builtin_oid.
|
|
*/
|
|
#define InvalidOidBuiltinMapping PG_UINT16_MAX
|
|
extern const uint16 fmgr_builtin_oid_index[];
|
|
|
|
#endif /* FMGRTAB_H */
|