Documentation of C functions

Started by Janek Sendrowskiover 12 years ago2 messagesgeneral
Jump to latest
#1Janek Sendrowski
janek12@web.de

Hi,
Is there a documentation of postgresql's C functions like SET_VARSIZE for exmaple?
 
Janek Sendrowski

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Janek Sendrowski (#1)
Re: Documentation of C functions

Janek Sendrowski wrote:

Is there a documentation of postgresql's C functions like SET_VARSIZE for exmaple?

For things like this consult the source code.

In src/include/postgres.h you'll find:

/*
* VARDATA, VARSIZE, and SET_VARSIZE are the recommended API for most code
* for varlena datatypes. Note that they only work on untoasted,
* 4-byte-header Datums!
*
* Code that wants to use 1-byte-header values without detoasting should
* use VARSIZE_ANY/VARSIZE_ANY_EXHDR/VARDATA_ANY. The other macros here
* should usually be used only by tuple assembly/disassembly code and
* code that specifically wants to work with still-toasted Datums.
*
* WARNING: It is only safe to use VARDATA_ANY() -- typically with
* PG_DETOAST_DATUM_PACKED() -- if you really don't care about the alignment.
* Either because you're working with something like text where the alignment
* doesn't matter or because you're not going to access its constituent parts
* and just use things like memcpy on it anyways.
*/

The server side C API is not documented in the documentation, because
it is already (hopefully) well documented in the source.

Yours,
Laurenz Albe

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general