Skip to content

Commit d393831

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 da57b15 commit d393831

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

doc/src/sgml/xfunc.sgml

Lines changed: 30 additions & 23 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">
@@ -2109,11 +2111,6 @@ memcpy(destination->data, buffer, 40);
21092111
<entry><type>AbsoluteTime</type></entry>
21102112
<entry><filename>utils/nabstime.h</filename></entry>
21112113
</row>
2112-
<row>
2113-
<entry><type>bigint</type> (<type>int8</type>)</entry>
2114-
<entry><type>int64</type></entry>
2115-
<entry><filename>postgres.h</filename></entry>
2116-
</row>
21172114
<row>
21182115
<entry><type>boolean</type></entry>
21192116
<entry><type>bool</type></entry>
@@ -2150,28 +2147,28 @@ memcpy(destination->data, buffer, 40);
21502147
<entry><filename>utils/date.h</filename></entry>
21512148
</row>
21522149
<row>
2153-
<entry><type>smallint</type> (<type>int2</type>)</entry>
2154-
<entry><type>int16</type></entry>
2155-
<entry><filename>postgres.h</filename></entry>
2150+
<entry><type>float4</type> (<type>real</type>)</entry>
2151+
<entry><type>float4</type></entry>
2152+
<entry><filename>postgres.h</filename></entry>
21562153
</row>
21572154
<row>
2158-
<entry><type>int2vector</type></entry>
2159-
<entry><type>int2vector*</type></entry>
2155+
<entry><type>float8</type> (<type>double precision</type>)</entry>
2156+
<entry><type>float8</type></entry>
21602157
<entry><filename>postgres.h</filename></entry>
21612158
</row>
21622159
<row>
2163-
<entry><type>integer</type> (<type>int4</type>)</entry>
2164-
<entry><type>int32</type></entry>
2160+
<entry><type>int2</type> (<type>smallint</type>)</entry>
2161+
<entry><type>int16</type></entry>
21652162
<entry><filename>postgres.h</filename></entry>
21662163
</row>
21672164
<row>
2168-
<entry><type>real</type> (<type>float4</type>)</entry>
2169-
<entry><type>float4*</type></entry>
2170-
<entry><filename>postgres.h</filename></entry>
2165+
<entry><type>int4</type> (<type>integer</type>)</entry>
2166+
<entry><type>int32</type></entry>
2167+
<entry><filename>postgres.h</filename></entry>
21712168
</row>
21722169
<row>
2173-
<entry><type>double precision</type> (<type>float8</type>)</entry>
2174-
<entry><type>float8*</type></entry>
2170+
<entry><type>int8</type> (<type>bigint</type>)</entry>
2171+
<entry><type>int64</type></entry>
21752172
<entry><filename>postgres.h</filename></entry>
21762173
</row>
21772174
<row>
@@ -2189,6 +2186,11 @@ memcpy(destination->data, buffer, 40);
21892186
<entry><type>Name</type></entry>
21902187
<entry><filename>postgres.h</filename></entry>
21912188
</row>
2189+
<row>
2190+
<entry><type>numeric</type></entry>
2191+
<entry><type>Numeric</type></entry>
2192+
<entry><filename>utils/numeric.h</filename></entry>
2193+
</row>
21922194
<row>
21932195
<entry><type>oid</type></entry>
21942196
<entry><type>Oid</type></entry>
@@ -2211,7 +2213,7 @@ memcpy(destination->data, buffer, 40);
22112213
</row>
22122214
<row>
22132215
<entry><type>regproc</type></entry>
2214-
<entry><type>regproc</type></entry>
2216+
<entry><type>RegProcedure</type></entry>
22152217
<entry><filename>postgres.h</filename></entry>
22162218
</row>
22172219
<row>
@@ -2244,6 +2246,11 @@ memcpy(destination->data, buffer, 40);
22442246
<entry><type>Timestamp</type></entry>
22452247
<entry><filename>datatype/timestamp.h</filename></entry>
22462248
</row>
2249+
<row>
2250+
<entry><type>timestamp with time zone</type></entry>
2251+
<entry><type>TimestampTz</type></entry>
2252+
<entry><filename>datatype/timestamp.h</filename></entry>
2253+
</row>
22472254
<row>
22482255
<entry><type>tinterval</type></entry>
22492256
<entry><type>TimeInterval</type></entry>

0 commit comments

Comments
 (0)