Skip to content

Commit 0862317

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 5ed74d8 commit 0862317

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
@@ -2075,16 +2075,18 @@ memcpy(destination->data, buffer, 40);
20752075
</para>
20762076

20772077
<para>
2078-
<xref linkend="xfunc-c-type-table"/> specifies which C type
2079-
corresponds to which SQL type when writing a C-language function
2080-
that uses a built-in type of <productname>PostgreSQL</productname>.
2078+
<xref linkend="xfunc-c-type-table"/> shows the C types
2079+
corresponding to many of the built-in SQL data types
2080+
of <productname>PostgreSQL</productname>.
20812081
The <quote>Defined In</quote> column gives the header file that
20822082
needs to be included to get the type definition. (The actual
20832083
definition might be in a different file that is included by the
20842084
listed file. It is recommended that users stick to the defined
20852085
interface.) Note that you should always include
2086-
<filename>postgres.h</filename> first in any source file, because
2087-
it declares a number of things that you will need anyway.
2086+
<filename>postgres.h</filename> first in any source file of server
2087+
code, because it declares a number of things that you will need
2088+
anyway, and because including other headers first can cause
2089+
portability issues.
20882090
</para>
20892091

20902092
<table tocentry="1" id="xfunc-c-type-table">
@@ -2140,28 +2142,28 @@ memcpy(destination->data, buffer, 40);
21402142
<entry><filename>utils/date.h</filename></entry>
21412143
</row>
21422144
<row>
2143-
<entry><type>smallint</type> (<type>int2</type>)</entry>
2144-
<entry><type>int16</type></entry>
2145-
<entry><filename>postgres.h</filename></entry>
2145+
<entry><type>float4</type> (<type>real</type>)</entry>
2146+
<entry><type>float4</type></entry>
2147+
<entry><filename>postgres.h</filename></entry>
21462148
</row>
21472149
<row>
2148-
<entry><type>int2vector</type></entry>
2149-
<entry><type>int2vector*</type></entry>
2150+
<entry><type>float8</type> (<type>double precision</type>)</entry>
2151+
<entry><type>float8</type></entry>
21502152
<entry><filename>postgres.h</filename></entry>
21512153
</row>
21522154
<row>
2153-
<entry><type>integer</type> (<type>int4</type>)</entry>
2154-
<entry><type>int32</type></entry>
2155+
<entry><type>int2</type> (<type>smallint</type>)</entry>
2156+
<entry><type>int16</type></entry>
21552157
<entry><filename>postgres.h</filename></entry>
21562158
</row>
21572159
<row>
2158-
<entry><type>real</type> (<type>float4</type>)</entry>
2159-
<entry><type>float4*</type></entry>
2160-
<entry><filename>postgres.h</filename></entry>
2160+
<entry><type>int4</type> (<type>integer</type>)</entry>
2161+
<entry><type>int32</type></entry>
2162+
<entry><filename>postgres.h</filename></entry>
21612163
</row>
21622164
<row>
2163-
<entry><type>double precision</type> (<type>float8</type>)</entry>
2164-
<entry><type>float8*</type></entry>
2165+
<entry><type>int8</type> (<type>bigint</type>)</entry>
2166+
<entry><type>int64</type></entry>
21652167
<entry><filename>postgres.h</filename></entry>
21662168
</row>
21672169
<row>
@@ -2179,6 +2181,11 @@ memcpy(destination->data, buffer, 40);
21792181
<entry><type>Name</type></entry>
21802182
<entry><filename>postgres.h</filename></entry>
21812183
</row>
2184+
<row>
2185+
<entry><type>numeric</type></entry>
2186+
<entry><type>Numeric</type></entry>
2187+
<entry><filename>utils/numeric.h</filename></entry>
2188+
</row>
21822189
<row>
21832190
<entry><type>oid</type></entry>
21842191
<entry><type>Oid</type></entry>
@@ -2201,7 +2208,7 @@ memcpy(destination->data, buffer, 40);
22012208
</row>
22022209
<row>
22032210
<entry><type>regproc</type></entry>
2204-
<entry><type>regproc</type></entry>
2211+
<entry><type>RegProcedure</type></entry>
22052212
<entry><filename>postgres.h</filename></entry>
22062213
</row>
22072214
<row>
@@ -2229,6 +2236,11 @@ memcpy(destination->data, buffer, 40);
22292236
<entry><type>Timestamp</type></entry>
22302237
<entry><filename>datatype/timestamp.h</filename></entry>
22312238
</row>
2239+
<row>
2240+
<entry><type>timestamp with time zone</type></entry>
2241+
<entry><type>TimestampTz</type></entry>
2242+
<entry><filename>datatype/timestamp.h</filename></entry>
2243+
</row>
22322244
<row>
22332245
<entry><type>varchar</type></entry>
22342246
<entry><type>VarChar*</type></entry>

0 commit comments

Comments
 (0)