From a96a1d656274d3e1ca7cd4c34b7ba79a2754b71d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 8 Dec 2021 16:54:31 -0500 Subject: [PATCH] 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 --- doc/src/sgml/xfunc.sgml | 52 +++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 8d40359193..365df66ee1 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -2104,16 +2104,18 @@ memcpy(destination->data, buffer, 40); - specifies which C type - corresponds to which SQL type when writing a C-language function - that uses a built-in type of PostgreSQL. + shows the C types + corresponding to many of the built-in SQL data types + of PostgreSQL. The Defined In column gives the header file that needs to be included to get the type definition. (The actual definition might be in a different file that is included by the listed file. It is recommended that users stick to the defined interface.) Note that you should always include - postgres.h first in any source file, because - it declares a number of things that you will need anyway. + postgres.h first in any source file of server + code, because it declares a number of things that you will need + anyway, and because including other headers first can cause + portability issues. @@ -2172,28 +2174,28 @@ memcpy(destination->data, buffer, 40); utils/date.h - smallint (int2) + float4 (real) + float4 + postgres.h + + + float8 (double precision) + float8 + postgres.h + + + int2 (smallint) int16 postgres.h - int2vector - int2vector* - postgres.h - - - integer (int4) + int4 (integer) int32 postgres.h - real (float4) - float4* - postgres.h - - - double precision (float8) - float8* + int8 (bigint) + int64 postgres.h @@ -2211,6 +2213,11 @@ memcpy(destination->data, buffer, 40); Name postgres.h + + numeric + Numeric + utils/numeric.h + oid Oid @@ -2233,7 +2240,7 @@ memcpy(destination->data, buffer, 40); regproc - regproc + RegProcedure postgres.h @@ -2261,6 +2268,11 @@ memcpy(destination->data, buffer, 40); Timestamp datatype/timestamp.h + + timestamp with time zone + TimestampTz + datatype/timestamp.h + varchar VarChar*