Skip to content

Commit 4f6f5db

Browse files
author
Neil Conway
committed
Add SPI_getnspname(), including documentation.
1 parent 70c9763 commit 4f6f5db

File tree

3 files changed

+64
-3
lines changed

3 files changed

+64
-3
lines changed

doc/src/sgml/spi.sgml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.39 2005/01/22 22:56:36 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.40 2005/03/29 02:53:53 neilc Exp $
33
-->
44

55
<chapter id="spi">
@@ -2153,6 +2153,60 @@ char * SPI_getrelname(Relation <parameter>rel</parameter>)
21532153
</refsect1>
21542154
</refentry>
21552155

2156+
<refentry id="spi-spi-getnspname">
2157+
<refmeta>
2158+
<refentrytitle>SPI_getnspname</refentrytitle>
2159+
</refmeta>
2160+
2161+
<refnamediv>
2162+
<refname>SPI_getnspname</refname>
2163+
<refpurpose>return the namespace of the specified relation</refpurpose>
2164+
</refnamediv>
2165+
2166+
<indexterm><primary>SPI_getnspname</primary></indexterm>
2167+
2168+
<refsynopsisdiv>
2169+
<synopsis>
2170+
char * SPI_getnspname(Relation <parameter>rel</parameter>)
2171+
</synopsis>
2172+
</refsynopsisdiv>
2173+
2174+
<refsect1>
2175+
<title>Description</title>
2176+
2177+
<para>
2178+
<function>SPI_getnspname</function> returns a copy of the name of
2179+
the namespace that the specified <structname>Relation</structname>
2180+
belongs to. This is equivalent to the relation's schema. You should
2181+
<function>pfree</function> the return value of this function when
2182+
you are finished with it.
2183+
</para>
2184+
</refsect1>
2185+
2186+
<refsect1>
2187+
<title>Arguments</title>
2188+
2189+
<variablelist>
2190+
<varlistentry>
2191+
<term><literal>Relation <parameter>rel</parameter></literal></term>
2192+
<listitem>
2193+
<para>
2194+
input relation
2195+
</para>
2196+
</listitem>
2197+
</varlistentry>
2198+
</variablelist>
2199+
</refsect1>
2200+
2201+
<refsect1>
2202+
<title>Return Value</title>
2203+
2204+
<para>
2205+
The name of the specified relation's namespace.
2206+
</para>
2207+
</refsect1>
2208+
</refentry>
2209+
21562210
</sect1>
21572211

21582212
<sect1 id="spi-memory">

src/backend/executor/spi.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.136 2005/03/25 21:57:58 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.137 2005/03/29 02:53:53 neilc Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -760,6 +760,12 @@ SPI_getrelname(Relation rel)
760760
return pstrdup(RelationGetRelationName(rel));
761761
}
762762

763+
char *
764+
SPI_getnspname(Relation rel)
765+
{
766+
return get_namespace_name(RelationGetNamespace(rel));
767+
}
768+
763769
void *
764770
SPI_palloc(Size size)
765771
{

src/include/executor/spi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* spi.h
44
*
5-
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.50 2004/11/16 18:10:13 tgl Exp $
5+
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.51 2005/03/29 02:53:53 neilc Exp $
66
*
77
*-------------------------------------------------------------------------
88
*/
@@ -113,6 +113,7 @@ extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool
113113
extern char *SPI_gettype(TupleDesc tupdesc, int fnumber);
114114
extern Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber);
115115
extern char *SPI_getrelname(Relation rel);
116+
extern char *SPI_getnspname(Relation rel);
116117
extern void *SPI_palloc(Size size);
117118
extern void *SPI_repalloc(void *pointer, Size size);
118119
extern void SPI_pfree(void *pointer);

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