Skip to content

Commit 23a8b77

Browse files
committed
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
1 parent ceb438e commit 23a8b77

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

doc/src/sgml/xfunc.sgml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.53 2002/07/18 04:47:17 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.54 2002/07/30 16:20:03 momjian Exp $
33
-->
44

55
<chapter id="xfunc">
@@ -1556,6 +1556,14 @@ HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
15561556
should be set to NULL.
15571557
</para>
15581558

1559+
<para>
1560+
In order to get an attribute "in" function and typelem value given the
1561+
typeid, use
1562+
<programlisting>
1563+
void get_type_metadata(Oid typeid, Oid *attinfuncid, Oid *attelem)
1564+
</programlisting>
1565+
</para>
1566+
15591567
<para>
15601568
Finally, in order to return a tuple using the SRF portion of the API
15611569
(described below), the tuple must be converted into a Datum. Use

src/backend/utils/misc/guc.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* command, configuration file, and command line options.
66
* See src/backend/utils/misc/README for more information.
77
*
8-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.75 2002/07/20 15:12:55 tgl Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.76 2002/07/30 16:20:03 momjian Exp $
99
*
1010
* Copyright 2000 by PostgreSQL Global Development Group
1111
* Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -2347,13 +2347,21 @@ GetConfigOptionByName(const char *name, const char **varname)
23472347
* form of name. Return value is palloc'd.
23482348
*/
23492349
char *
2350-
GetConfigOptionByNum(int varnum, const char **varname)
2350+
GetConfigOptionByNum(int varnum, const char **varname, bool *noshow)
23512351
{
2352-
struct config_generic *conf = guc_variables[varnum];
2352+
struct config_generic *conf;
2353+
2354+
/* check requested variable number valid */
2355+
Assert((varnum >= 0) && (varnum < num_guc_variables));
2356+
2357+
conf = guc_variables[varnum];
23532358

23542359
if (varname)
23552360
*varname = conf->name;
23562361

2362+
if (noshow)
2363+
*noshow = (conf->flags & GUC_NO_SHOW_ALL) ? true : false;
2364+
23572365
return _ShowOption(conf);
23582366
}
23592367

src/include/funcapi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ typedef struct
139139
* HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values) -
140140
* build a HeapTuple given user data in C string form. values is an array
141141
* of C strings, one for each attribute of the return tuple.
142+
* void get_type_metadata(Oid typeid, Oid *attinfuncid, Oid *attelem) - Get
143+
* an attribute "in" function and typelem value given the typeid.
142144
*
143145
* Macro declarations:
144146
* TupleGetDatum(TupleTableSlot *slot, HeapTuple tuple) - get a Datum

src/include/utils/guc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* External declarations pertaining to backend/utils/misc/guc.c and
55
* backend/utils/misc/guc-file.l
66
*
7-
* $Id: guc.h,v 1.19 2002/07/20 15:12:56 tgl Exp $
7+
* $Id: guc.h,v 1.20 2002/07/30 16:20:03 momjian Exp $
88
*/
99
#ifndef GUC_H
1010
#define GUC_H
@@ -87,7 +87,7 @@ extern bool set_config_option(const char *name, const char *value,
8787
extern void ShowGUCConfigOption(const char *name);
8888
extern void ShowAllGUCConfig(void);
8989
extern char *GetConfigOptionByName(const char *name, const char **varname);
90-
extern char *GetConfigOptionByNum(int varnum, const char **varname);
90+
extern char *GetConfigOptionByNum(int varnum, const char **varname, bool *noshow);
9191
extern int GetNumConfigOptions(void);
9292

9393
extern void SetPGVariable(const char *name, List *args, bool is_local);

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