Here are two patches. The guc_and_tablefunc patch addresses the two
authorBruce Momjian
Tue, 30 Jul 2002 16:20:03 +0000 (16:20 +0000)
committerBruce Momjian
Tue, 30 Jul 2002 16:20:03 +0000 (16:20 +0000)
changes mentioned above, and also adds a new function to the tablefunc
API. The tablefunc API change adds the following function:

* Oid foidGetTypeId(Oid foid) - Get a function's typeid given the
* function Oid. Use this together with TypeGetTupleDesc() to get a
* TupleDesc which is derived from the function's declared return type.

In the next post I'll send the contrib/tablefunc patch, which
illustrates the usage of this new function. Also attached is a doc patch
for this change. The doc patch also adds a function that I failed to
document previously.

Joe Conway

doc/src/sgml/xfunc.sgml
src/backend/utils/misc/guc.c
src/include/funcapi.h
src/include/utils/guc.h

index bb7f742f69fbdaf9c94188b7203b1ec8f6c68fe8..91d1849d529bf8ff6df20859a3e70d6ee8a4fa55 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -1556,6 +1556,14 @@ HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
      should be set to NULL.
     
 
+    
+     In order to get an attribute "in" function and typelem value given the
+     typeid, use
+
+void get_type_metadata(Oid typeid, Oid *attinfuncid, Oid *attelem)
+
+    
+
     
      Finally, in order to return a tuple using the SRF portion of the API
      (described below), the tuple must be converted into a Datum. Use
index c90c52e8ccfd5a9f7dc9ac53903d2ec60e447bb1..4a03c95277b6d356f484de5098a461a1ce09de6d 100644 (file)
@@ -5,7 +5,7 @@
  * command, configuration file, and command line options.
  * See src/backend/utils/misc/README for more information.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.75 2002/07/20 15:12:55 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.76 2002/07/30 16:20:03 momjian Exp $
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  * Written by Peter Eisentraut .
@@ -2347,13 +2347,21 @@ GetConfigOptionByName(const char *name, const char **varname)
  * form of name.  Return value is palloc'd.
  */
 char *
-GetConfigOptionByNum(int varnum, const char **varname)
+GetConfigOptionByNum(int varnum, const char **varname, bool *noshow)
 {
-   struct config_generic *conf = guc_variables[varnum];
+   struct config_generic *conf;
+
+   /* check requested variable number valid */
+   Assert((varnum >= 0) && (varnum < num_guc_variables));
+
+   conf = guc_variables[varnum];
 
    if (varname)
        *varname = conf->name;
 
+   if (noshow)
+       *noshow = (conf->flags & GUC_NO_SHOW_ALL) ? true : false;
+
    return _ShowOption(conf);
 }
 
index f00b93b865b518d9f0cc9cccd72f7dc77b9ae51e..294147538206bc2aa2f8e7c08f825f6d6766209d 100644 (file)
@@ -139,6 +139,8 @@ typedef struct
  * HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values) -
  *     build a HeapTuple given user data in C string form. values is an array
  *     of C strings, one for each attribute of the return tuple.
+ * void get_type_metadata(Oid typeid, Oid *attinfuncid, Oid *attelem) - Get
+ *      an attribute "in" function and typelem value given the typeid.
  *
  * Macro declarations:
  * TupleGetDatum(TupleTableSlot *slot, HeapTuple tuple) - get a Datum
index 17e4f3d652f848b8acc90fa0cbe5049f2a4d84e7..b6d1421ec49a48cf4eb935433b78146544c8016d 100644 (file)
@@ -4,7 +4,7 @@
  * External declarations pertaining to backend/utils/misc/guc.c and
  * backend/utils/misc/guc-file.l
  *
- * $Id: guc.h,v 1.19 2002/07/20 15:12:56 tgl Exp $
+ * $Id: guc.h,v 1.20 2002/07/30 16:20:03 momjian Exp $
  */
 #ifndef GUC_H
 #define GUC_H
@@ -87,7 +87,7 @@ extern bool set_config_option(const char *name, const char *value,
 extern void ShowGUCConfigOption(const char *name);
 extern void ShowAllGUCConfig(void);
 extern char *GetConfigOptionByName(const char *name, const char **varname);
-extern char *GetConfigOptionByNum(int varnum, const char **varname);
+extern char *GetConfigOptionByNum(int varnum, const char **varname, bool *noshow);
 extern int GetNumConfigOptions(void);
 
 extern void SetPGVariable(const char *name, List *args, bool is_local);