summaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-05-28 17:56:29 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-05-28 17:56:29 +0000
commit0a7fb4e9184539afcb6fed0f1d2bc0abddc2b0a6 (patch)
treeaffcce1c5b6367468fb6dcfd2790585f2e967629 /src/include/utils
parent5005bb060b3f3a82cd1bd662c7f8946c9be59db5 (diff)
downloadpostgresql-0a7fb4e9184539afcb6fed0f1d2bc0abddc2b0a6.tar.gz
First round of changes for new fmgr interface. fmgr itself and the
key call sites are changed, but most called functions are still oldstyle. An exception is that the PL managers are updated (so, for example, NULL handling now behaves as expected in plperl and plpgsql functions). NOTE initdb is forced due to added column in pg_proc.
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/dynamic_loader.h22
-rw-r--r--src/include/utils/fcache.h33
-rw-r--r--src/include/utils/fmgrtab.h31
-rw-r--r--src/include/utils/int8.h24
4 files changed, 39 insertions, 71 deletions
diff --git a/src/include/utils/dynamic_loader.h b/src/include/utils/dynamic_loader.h
index a83baae40e..535d5c6d3a 100644
--- a/src/include/utils/dynamic_loader.h
+++ b/src/include/utils/dynamic_loader.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: dynamic_loader.h,v 1.14 2000/01/26 05:58:37 momjian Exp $
+ * $Id: dynamic_loader.h,v 1.15 2000/05/28 17:56:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,26 +19,12 @@
/* we need this include because port files use them */
#include "postgres.h"
-#ifdef MIN
-#undef MIN
-#undef MAX
-#endif /* MIN */
+/* and this one for typedef PGFunction */
+#include "fmgr.h"
-/*
- * List of dynamically loaded files.
- */
-
-typedef struct df_files
-{
- char filename[MAXPGPATH]; /* Full pathname of file */
- dev_t device; /* Device file is on */
- ino_t inode; /* Inode number of file */
- void *handle; /* a handle for pg_dl* functions */
- struct df_files *next;
-} DynamicFileList;
extern void *pg_dlopen(char *filename);
-extern func_ptr pg_dlsym(void *handle, char *funcname);
+extern PGFunction pg_dlsym(void *handle, char *funcname);
extern void pg_dlclose(void *handle);
extern char *pg_dlerror(void);
diff --git a/src/include/utils/fcache.h b/src/include/utils/fcache.h
index 24e6db1f0c..db3a05baf4 100644
--- a/src/include/utils/fcache.h
+++ b/src/include/utils/fcache.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: fcache.h,v 1.10 2000/01/26 05:58:38 momjian Exp $
+ * $Id: fcache.h,v 1.11 2000/05/28 17:56:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,22 +19,11 @@
typedef struct
{
- int typlen; /* length of the return type */
- int typbyval; /* true if return type is pass by value */
- FmgrInfo func; /* address of function to call (for c
- * funcs) */
+ FmgrInfo func; /* info for fmgr call mechanism */
Oid foid; /* oid of the function in pg_proc */
Oid language; /* oid of the language in pg_language */
- int nargs; /* number of arguments */
-
- /* Might want to make these two arrays of size MAXFUNCARGS */
-
- Oid *argOidVect; /* oids of all the arguments */
- bool *nullVect; /* keep track of null arguments */
-
- char *src; /* source code of the function */
- char *bin; /* binary object code ?? */
- char *func_state; /* fuction_state struct for execution */
+ int typlen; /* length of the return type */
+ bool typbyval; /* true if return type is pass by value */
bool oneResult; /* true we only want 1 result from the
* function */
@@ -42,17 +31,23 @@ typedef struct
* expr whose argument is func returning a
* set ugh! */
+ int nargs; /* actual number of arguments */
+ Oid *argOidVect; /* oids of all the argument types */
+
+ char *src; /* source code of the function */
+ char *bin; /* binary object code ?? */
+ char *func_state; /* function_state struct for execution */
+
Pointer funcSlot; /* if one result we need to copy it before
* we end execution of the function and
* free stuff */
- char *setArg; /* current argument for nested dot
+ Datum setArg; /* current argument for nested dot
* execution Nested dot expressions mean
* we have funcs whose argument is a set
* of tuples */
+} FunctionCache;
- bool istrusted; /* trusted fn? */
-} FunctionCache,
- *FunctionCachePtr;
+typedef FunctionCache *FunctionCachePtr;
#endif /* FCACHE_H */
diff --git a/src/include/utils/fmgrtab.h b/src/include/utils/fmgrtab.h
index 21e28904d5..e6cfe51965 100644
--- a/src/include/utils/fmgrtab.h
+++ b/src/include/utils/fmgrtab.h
@@ -1,30 +1,39 @@
/*-------------------------------------------------------------------------
*
* fmgrtab.h
- *
- *
+ * The function manager's table of internal functions.
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: fmgrtab.h,v 1.12 2000/01/26 05:58:38 momjian Exp $
+ * $Id: fmgrtab.h,v 1.13 2000/05/28 17:56:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef FMGRTAB_H
#define FMGRTAB_H
+#include "fmgr.h"
+
+
+/*
+ * This table stores info about all the built-in functions (ie, functions
+ * that are compiled into the Postgres executable). The table entries are
+ * required to appear in Oid order, so that binary search can be used.
+ */
typedef struct
{
- Oid proid;
- int nargs;
- func_ptr func;
- char *funcName;
-} FmgrCall;
+ Oid foid; /* OID of the function */
+ const char *funcName; /* C name of the function */
+ short nargs; /* 0..FUNC_MAX_ARGS, or -1 if variable count */
+ bool strict; /* T if function is "strict" */
+ bool oldstyle; /* T if function uses old fmgr interface */
+ PGFunction func; /* pointer to compiled function */
+} FmgrBuiltin;
+
+extern const FmgrBuiltin fmgr_builtins[];
-extern FmgrCall *fmgr_isbuiltin(Oid id);
-extern func_ptr fmgr_lookupByName(char *name);
-extern void load_file(char *filename);
+extern const int fmgr_nbuiltins; /* number of entries in table */
#endif /* FMGRTAB_H */
diff --git a/src/include/utils/int8.h b/src/include/utils/int8.h
index dab1e0addd..b8ad531ab2 100644
--- a/src/include/utils/int8.h
+++ b/src/include/utils/int8.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: int8.h,v 1.20 2000/04/12 17:16:55 momjian Exp $
+ * $Id: int8.h,v 1.21 2000/05/28 17:56:20 tgl Exp $
*
* NOTES
* These data types are supported on all 64-bit architectures, and may
@@ -24,28 +24,6 @@
#ifndef INT8_H
#define INT8_H
-#ifdef HAVE_LONG_INT_64
-/* Plain "long int" fits, use it */
-typedef long int int64;
-
-#else
-#ifdef HAVE_LONG_LONG_INT_64
-/* We have working support for "long long int", use that */
-typedef long long int int64;
-
-#else
-/* Won't actually work, but fall back to long int so that int8.c compiles */
-typedef long int int64;
-
-#define INT64_IS_BUSTED
-#endif
-#endif
-
-/* this should be set in config.h: */
-#ifndef INT64_FORMAT
-#define INT64_FORMAT "%ld"
-#endif
-
extern int64 *int8in(char *str);
extern char *int8out(int64 *val);