Skip to content

Commit 6f0e6ab

Browse files
committed
Doc: improve xfunc-c-type-table.
List types numeric and timestamptz, which don't seem to have ever been included here. Restore bigint, which was no-doubt-accidentally deleted in v12. Fix some errors, or at least obsolete usages (nobody declares float arguments as "float8*" anymore, even though they might be that under the hood). Re-alphabetize. Remove the seeming claim that this is a complete list of built-in types. Per question from Oskar Stenberg. Discussion: https://postgr.es/m/HE1PR03MB2971DE2527ECE1E99D6C19A8F96E9@HE1PR03MB2971.eurprd03.prod.outlook.com
1 parent 745b99c commit 6f0e6ab

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

doc/src/sgml/xfunc.sgml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,16 +2166,18 @@ memcpy(destination->data, buffer, 40);
21662166
</para>
21672167

21682168
<para>
2169-
<xref linkend="xfunc-c-type-table"/> specifies which C type
2170-
corresponds to which SQL type when writing a C-language function
2171-
that uses a built-in type of <productname>PostgreSQL</productname>.
2169+
<xref linkend="xfunc-c-type-table"/> shows the C types
2170+
corresponding to many of the built-in SQL data types
2171+
of <productname>PostgreSQL</productname>.
21722172
The <quote>Defined In</quote> column gives the header file that
21732173
needs to be included to get the type definition. (The actual
21742174
definition might be in a different file that is included by the
21752175
listed file. It is recommended that users stick to the defined
21762176
interface.) Note that you should always include
2177-
<filename>postgres.h</filename> first in any source file, because
2178-
it declares a number of things that you will need anyway.
2177+
<filename>postgres.h</filename> first in any source file of server
2178+
code, because it declares a number of things that you will need
2179+
anyway, and because including other headers first can cause
2180+
portability issues.
21792181
</para>
21802182

21812183
<table tocentry="1" id="xfunc-c-type-table">
@@ -2234,28 +2236,28 @@ memcpy(destination->data, buffer, 40);
22342236
<entry><filename>utils/date.h</filename></entry>
22352237
</row>
22362238
<row>
2237-
<entry><type>smallint</type> (<type>int2</type>)</entry>
2238-
<entry><type>int16</type></entry>
2239-
<entry><filename>postgres.h</filename></entry>
2239+
<entry><type>float4</type> (<type>real</type>)</entry>
2240+
<entry><type>float4</type></entry>
2241+
<entry><filename>postgres.h</filename></entry>
22402242
</row>
22412243
<row>
2242-
<entry><type>int2vector</type></entry>
2243-
<entry><type>int2vector*</type></entry>
2244+
<entry><type>float8</type> (<type>double precision</type>)</entry>
2245+
<entry><type>float8</type></entry>
22442246
<entry><filename>postgres.h</filename></entry>
22452247
</row>
22462248
<row>
2247-
<entry><type>integer</type> (<type>int4</type>)</entry>
2248-
<entry><type>int32</type></entry>
2249+
<entry><type>int2</type> (<type>smallint</type>)</entry>
2250+
<entry><type>int16</type></entry>
22492251
<entry><filename>postgres.h</filename></entry>
22502252
</row>
22512253
<row>
2252-
<entry><type>real</type> (<type>float4</type>)</entry>
2253-
<entry><type>float4*</type></entry>
2254-
<entry><filename>postgres.h</filename></entry>
2254+
<entry><type>int4</type> (<type>integer</type>)</entry>
2255+
<entry><type>int32</type></entry>
2256+
<entry><filename>postgres.h</filename></entry>
22552257
</row>
22562258
<row>
2257-
<entry><type>double precision</type> (<type>float8</type>)</entry>
2258-
<entry><type>float8*</type></entry>
2259+
<entry><type>int8</type> (<type>bigint</type>)</entry>
2260+
<entry><type>int64</type></entry>
22592261
<entry><filename>postgres.h</filename></entry>
22602262
</row>
22612263
<row>
@@ -2273,6 +2275,11 @@ memcpy(destination->data, buffer, 40);
22732275
<entry><type>Name</type></entry>
22742276
<entry><filename>postgres.h</filename></entry>
22752277
</row>
2278+
<row>
2279+
<entry><type>numeric</type></entry>
2280+
<entry><type>Numeric</type></entry>
2281+
<entry><filename>utils/numeric.h</filename></entry>
2282+
</row>
22762283
<row>
22772284
<entry><type>oid</type></entry>
22782285
<entry><type>Oid</type></entry>
@@ -2295,7 +2302,7 @@ memcpy(destination->data, buffer, 40);
22952302
</row>
22962303
<row>
22972304
<entry><type>regproc</type></entry>
2298-
<entry><type>regproc</type></entry>
2305+
<entry><type>RegProcedure</type></entry>
22992306
<entry><filename>postgres.h</filename></entry>
23002307
</row>
23012308
<row>
@@ -2323,6 +2330,11 @@ memcpy(destination->data, buffer, 40);
23232330
<entry><type>Timestamp</type></entry>
23242331
<entry><filename>datatype/timestamp.h</filename></entry>
23252332
</row>
2333+
<row>
2334+
<entry><type>timestamp with time zone</type></entry>
2335+
<entry><type>TimestampTz</type></entry>
2336+
<entry><filename>datatype/timestamp.h</filename></entry>
2337+
</row>
23262338
<row>
23272339
<entry><type>varchar</type></entry>
23282340
<entry><type>VarChar*</type></entry>

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