Here are two patches. The guc_and_tablefunc patch addresses the two
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
This commit is contained in:
parent
ceb438ed8c
commit
23a8b77d42
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.53 2002/07/18 04:47:17 momjian Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.54 2002/07/30 16:20:03 momjian Exp $
|
||||
-->
|
||||
|
||||
<chapter id="xfunc">
|
||||
@ -1556,6 +1556,14 @@ HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
|
||||
should be set to NULL.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In order to get an attribute "in" function and typelem value given the
|
||||
typeid, use
|
||||
<programlisting>
|
||||
void get_type_metadata(Oid typeid, Oid *attinfuncid, Oid *attelem)
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
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
|
||||
|
@ -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 <peter_e@gmx.net>.
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user